Coverage for cuda / bindings / nvml.pyx: 33.94%
12060 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-10 13:25 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-02-10 13:25 +0000
1# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2#
3# SPDX-License-Identifier: LicenseRef-NVIDIA-SOFTWARE-LICENSE
4#
5# This code was automatically generated across versions from 12.9.1 to 13.1.1. Do not modify it directly.
7cimport cython # NOQA
9from ._internal.utils cimport (get_buffer_pointer, get_nested_resource_ptr,
10 nested_resource)
12from enum import IntEnum as _IntEnum
14from cuda.bindings.cydriver cimport CUDA_VERSION
17from libc.stdlib cimport calloc, free, malloc
18from cython cimport view
19cimport cpython.buffer
20cimport cpython.memoryview
21cimport cpython
22from libc.string cimport memcmp, memcpy
23import numpy as _numpy
26cdef __from_data(data, dtype_name, expected_dtype, lowpp_type):
27 # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here.
28 if isinstance(data, lowpp_type):
29 return data
30 if not isinstance(data, _numpy.ndarray):
31 raise TypeError("data argument must be a NumPy ndarray")
32 if data.size != 1:
33 raise ValueError("data array must have a size of 1")
34 if data.dtype != expected_dtype:
35 raise ValueError(f"data array must be of dtype {dtype_name}")
36 return lowpp_type.from_ptr(data.ctypes.data, not data.flags.writeable, data)
40cdef inline unsigned int NVML_VERSION_STRUCT(const unsigned int size, const unsigned int ver) nogil:
41 return (size | (ver << 24)) 2nbWbXbobH 0 p V D F i b r m c t n u l Rbv
44###############################################################################
45# Enum
46###############################################################################
48class BridgeChipType(_IntEnum):
49 """See `nvmlBridgeChipType_t`."""
50 BRIDGE_CHIP_PLX = NVML_BRIDGE_CHIP_PLX
51 BRIDGE_CHIP_BRO4 = NVML_BRIDGE_CHIP_BRO4
53class NvLinkUtilizationCountUnits(_IntEnum):
54 """See `nvmlNvLinkUtilizationCountUnits_t`."""
55 NVLINK_COUNTER_UNIT_CYCLES = NVML_NVLINK_COUNTER_UNIT_CYCLES
56 NVLINK_COUNTER_UNIT_PACKETS = NVML_NVLINK_COUNTER_UNIT_PACKETS
57 NVLINK_COUNTER_UNIT_BYTES = NVML_NVLINK_COUNTER_UNIT_BYTES
58 NVLINK_COUNTER_UNIT_RESERVED = NVML_NVLINK_COUNTER_UNIT_RESERVED
59 NVLINK_COUNTER_UNIT_COUNT = NVML_NVLINK_COUNTER_UNIT_COUNT
61class NvLinkUtilizationCountPktTypes(_IntEnum):
62 """See `nvmlNvLinkUtilizationCountPktTypes_t`."""
63 NVLINK_COUNTER_PKTFILTER_NOP = NVML_NVLINK_COUNTER_PKTFILTER_NOP
64 NVLINK_COUNTER_PKTFILTER_READ = NVML_NVLINK_COUNTER_PKTFILTER_READ
65 NVLINK_COUNTER_PKTFILTER_WRITE = NVML_NVLINK_COUNTER_PKTFILTER_WRITE
66 NVLINK_COUNTER_PKTFILTER_RATOM = NVML_NVLINK_COUNTER_PKTFILTER_RATOM
67 NVLINK_COUNTER_PKTFILTER_NRATOM = NVML_NVLINK_COUNTER_PKTFILTER_NRATOM
68 NVLINK_COUNTER_PKTFILTER_FLUSH = NVML_NVLINK_COUNTER_PKTFILTER_FLUSH
69 NVLINK_COUNTER_PKTFILTER_RESPDATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA
70 NVLINK_COUNTER_PKTFILTER_RESPNODATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA
71 NVLINK_COUNTER_PKTFILTER_ALL = NVML_NVLINK_COUNTER_PKTFILTER_ALL
73class NvLinkCapability(_IntEnum):
74 """See `nvmlNvLinkCapability_t`."""
75 NVLINK_CAP_P2P_SUPPORTED = NVML_NVLINK_CAP_P2P_SUPPORTED
76 NVLINK_CAP_SYSMEM_ACCESS = NVML_NVLINK_CAP_SYSMEM_ACCESS
77 NVLINK_CAP_P2P_ATOMICS = NVML_NVLINK_CAP_P2P_ATOMICS
78 NVLINK_CAP_SYSMEM_ATOMICS = NVML_NVLINK_CAP_SYSMEM_ATOMICS
79 NVLINK_CAP_SLI_BRIDGE = NVML_NVLINK_CAP_SLI_BRIDGE
80 NVLINK_CAP_VALID = NVML_NVLINK_CAP_VALID
81 NVLINK_CAP_COUNT = NVML_NVLINK_CAP_COUNT
83class NvLinkErrorCounter(_IntEnum):
84 """See `nvmlNvLinkErrorCounter_t`."""
85 NVLINK_ERROR_DL_REPLAY = NVML_NVLINK_ERROR_DL_REPLAY
86 NVLINK_ERROR_DL_RECOVERY = NVML_NVLINK_ERROR_DL_RECOVERY
87 NVLINK_ERROR_DL_CRC_FLIT = NVML_NVLINK_ERROR_DL_CRC_FLIT
88 NVLINK_ERROR_DL_CRC_DATA = NVML_NVLINK_ERROR_DL_CRC_DATA
89 NVLINK_ERROR_DL_ECC_DATA = NVML_NVLINK_ERROR_DL_ECC_DATA
90 NVLINK_ERROR_COUNT = NVML_NVLINK_ERROR_COUNT
92class IntNvLinkDeviceType(_IntEnum):
93 """See `nvmlIntNvLinkDeviceType_t`."""
94 NVLINK_DEVICE_TYPE_GPU = NVML_NVLINK_DEVICE_TYPE_GPU
95 NVLINK_DEVICE_TYPE_IBMNPU = NVML_NVLINK_DEVICE_TYPE_IBMNPU
96 NVLINK_DEVICE_TYPE_SWITCH = NVML_NVLINK_DEVICE_TYPE_SWITCH
97 NVLINK_DEVICE_TYPE_UNKNOWN = NVML_NVLINK_DEVICE_TYPE_UNKNOWN
99class GpuTopologyLevel(_IntEnum):
100 """See `nvmlGpuTopologyLevel_t`."""
101 TOPOLOGY_INTERNAL = NVML_TOPOLOGY_INTERNAL
102 TOPOLOGY_SINGLE = NVML_TOPOLOGY_SINGLE
103 TOPOLOGY_MULTIPLE = NVML_TOPOLOGY_MULTIPLE
104 TOPOLOGY_HOSTBRIDGE = NVML_TOPOLOGY_HOSTBRIDGE
105 TOPOLOGY_NODE = NVML_TOPOLOGY_NODE
106 TOPOLOGY_SYSTEM = NVML_TOPOLOGY_SYSTEM
108class GpuP2PStatus(_IntEnum):
109 """See `nvmlGpuP2PStatus_t`."""
110 P2P_STATUS_OK = NVML_P2P_STATUS_OK
111 P2P_STATUS_CHIPSET_NOT_SUPPORED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED
112 P2P_STATUS_CHIPSET_NOT_SUPPORTED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED
113 P2P_STATUS_GPU_NOT_SUPPORTED = NVML_P2P_STATUS_GPU_NOT_SUPPORTED
114 P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED = NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED
115 P2P_STATUS_DISABLED_BY_REGKEY = NVML_P2P_STATUS_DISABLED_BY_REGKEY
116 P2P_STATUS_NOT_SUPPORTED = NVML_P2P_STATUS_NOT_SUPPORTED
117 P2P_STATUS_UNKNOWN = NVML_P2P_STATUS_UNKNOWN
119class GpuP2PCapsIndex(_IntEnum):
120 """See `nvmlGpuP2PCapsIndex_t`."""
121 P2P_CAPS_INDEX_READ = NVML_P2P_CAPS_INDEX_READ
122 P2P_CAPS_INDEX_WRITE = NVML_P2P_CAPS_INDEX_WRITE
123 P2P_CAPS_INDEX_NVLINK = NVML_P2P_CAPS_INDEX_NVLINK
124 P2P_CAPS_INDEX_ATOMICS = NVML_P2P_CAPS_INDEX_ATOMICS
125 P2P_CAPS_INDEX_PCI = NVML_P2P_CAPS_INDEX_PCI
126 P2P_CAPS_INDEX_PROP = NVML_P2P_CAPS_INDEX_PROP
127 P2P_CAPS_INDEX_UNKNOWN = NVML_P2P_CAPS_INDEX_UNKNOWN
129class SamplingType(_IntEnum):
130 """See `nvmlSamplingType_t`."""
131 TOTAL_POWER_SAMPLES = NVML_TOTAL_POWER_SAMPLES
132 GPU_UTILIZATION_SAMPLES = NVML_GPU_UTILIZATION_SAMPLES
133 MEMORY_UTILIZATION_SAMPLES = NVML_MEMORY_UTILIZATION_SAMPLES
134 ENC_UTILIZATION_SAMPLES = NVML_ENC_UTILIZATION_SAMPLES
135 DEC_UTILIZATION_SAMPLES = NVML_DEC_UTILIZATION_SAMPLES
136 PROCESSOR_CLK_SAMPLES = NVML_PROCESSOR_CLK_SAMPLES
137 MEMORY_CLK_SAMPLES = NVML_MEMORY_CLK_SAMPLES
138 MODULE_POWER_SAMPLES = NVML_MODULE_POWER_SAMPLES
139 JPG_UTILIZATION_SAMPLES = NVML_JPG_UTILIZATION_SAMPLES
140 OFA_UTILIZATION_SAMPLES = NVML_OFA_UTILIZATION_SAMPLES
141 SAMPLINGTYPE_COUNT = NVML_SAMPLINGTYPE_COUNT
143class PcieUtilCounter(_IntEnum):
144 """See `nvmlPcieUtilCounter_t`."""
145 PCIE_UTIL_TX_BYTES = NVML_PCIE_UTIL_TX_BYTES
146 PCIE_UTIL_RX_BYTES = NVML_PCIE_UTIL_RX_BYTES
147 PCIE_UTIL_COUNT = NVML_PCIE_UTIL_COUNT
149class ValueType(_IntEnum):
150 """See `nvmlValueType_t`."""
151 DOUBLE = NVML_VALUE_TYPE_DOUBLE
152 UNSIGNED_INT = NVML_VALUE_TYPE_UNSIGNED_INT
153 UNSIGNED_LONG = NVML_VALUE_TYPE_UNSIGNED_LONG
154 UNSIGNED_LONG_LONG = NVML_VALUE_TYPE_UNSIGNED_LONG_LONG
155 SIGNED_LONG_LONG = NVML_VALUE_TYPE_SIGNED_LONG_LONG
156 SIGNED_INT = NVML_VALUE_TYPE_SIGNED_INT
157 UNSIGNED_SHORT = NVML_VALUE_TYPE_UNSIGNED_SHORT
158 COUNT = NVML_VALUE_TYPE_COUNT
160class PerfPolicyType(_IntEnum):
161 """See `nvmlPerfPolicyType_t`."""
162 PERF_POLICY_POWER = NVML_PERF_POLICY_POWER
163 PERF_POLICY_THERMAL = NVML_PERF_POLICY_THERMAL
164 PERF_POLICY_SYNC_BOOST = NVML_PERF_POLICY_SYNC_BOOST
165 PERF_POLICY_BOARD_LIMIT = NVML_PERF_POLICY_BOARD_LIMIT
166 PERF_POLICY_LOW_UTILIZATION = NVML_PERF_POLICY_LOW_UTILIZATION
167 PERF_POLICY_RELIABILITY = NVML_PERF_POLICY_RELIABILITY
168 PERF_POLICY_TOTAL_APP_CLOCKS = NVML_PERF_POLICY_TOTAL_APP_CLOCKS
169 PERF_POLICY_TOTAL_BASE_CLOCKS = NVML_PERF_POLICY_TOTAL_BASE_CLOCKS
170 PERF_POLICY_COUNT = NVML_PERF_POLICY_COUNT
172class ThermalTarget(_IntEnum):
173 """See `nvmlThermalTarget_t`."""
174 NONE = NVML_THERMAL_TARGET_NONE
175 GPU = NVML_THERMAL_TARGET_GPU
176 MEMORY = NVML_THERMAL_TARGET_MEMORY
177 POWER_SUPPLY = NVML_THERMAL_TARGET_POWER_SUPPLY
178 BOARD = NVML_THERMAL_TARGET_BOARD
179 VCD_BOARD = NVML_THERMAL_TARGET_VCD_BOARD
180 VCD_INLET = NVML_THERMAL_TARGET_VCD_INLET
181 VCD_OUTLET = NVML_THERMAL_TARGET_VCD_OUTLET
182 ALL = NVML_THERMAL_TARGET_ALL
183 UNKNOWN = NVML_THERMAL_TARGET_UNKNOWN
185class ThermalController(_IntEnum):
186 """See `nvmlThermalController_t`."""
187 NONE = NVML_THERMAL_CONTROLLER_NONE
188 GPU_INTERNAL = NVML_THERMAL_CONTROLLER_GPU_INTERNAL
189 ADM1032 = NVML_THERMAL_CONTROLLER_ADM1032
190 ADT7461 = NVML_THERMAL_CONTROLLER_ADT7461
191 MAX6649 = NVML_THERMAL_CONTROLLER_MAX6649
192 MAX1617 = NVML_THERMAL_CONTROLLER_MAX1617
193 LM99 = NVML_THERMAL_CONTROLLER_LM99
194 LM89 = NVML_THERMAL_CONTROLLER_LM89
195 LM64 = NVML_THERMAL_CONTROLLER_LM64
196 G781 = NVML_THERMAL_CONTROLLER_G781
197 ADT7473 = NVML_THERMAL_CONTROLLER_ADT7473
198 SBMAX6649 = NVML_THERMAL_CONTROLLER_SBMAX6649
199 VBIOSEVT = NVML_THERMAL_CONTROLLER_VBIOSEVT
200 OS = NVML_THERMAL_CONTROLLER_OS
201 NVSYSCON_CANOAS = NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS
202 NVSYSCON_E551 = NVML_THERMAL_CONTROLLER_NVSYSCON_E551
203 MAX6649R = NVML_THERMAL_CONTROLLER_MAX6649R
204 ADT7473S = NVML_THERMAL_CONTROLLER_ADT7473S
205 UNKNOWN = NVML_THERMAL_CONTROLLER_UNKNOWN
207class CoolerControl(_IntEnum):
208 """See `nvmlCoolerControl_t`."""
209 THERMAL_COOLER_SIGNAL_NONE = NVML_THERMAL_COOLER_SIGNAL_NONE
210 THERMAL_COOLER_SIGNAL_TOGGLE = NVML_THERMAL_COOLER_SIGNAL_TOGGLE
211 THERMAL_COOLER_SIGNAL_VARIABLE = NVML_THERMAL_COOLER_SIGNAL_VARIABLE
212 THERMAL_COOLER_SIGNAL_COUNT = NVML_THERMAL_COOLER_SIGNAL_COUNT
214class CoolerTarget(_IntEnum):
215 """See `nvmlCoolerTarget_t`."""
216 THERMAL_NONE = NVML_THERMAL_COOLER_TARGET_NONE
217 THERMAL_GPU = NVML_THERMAL_COOLER_TARGET_GPU
218 THERMAL_MEMORY = NVML_THERMAL_COOLER_TARGET_MEMORY
219 THERMAL_POWER_SUPPLY = NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY
220 THERMAL_GPU_RELATED = NVML_THERMAL_COOLER_TARGET_GPU_RELATED
222class UUIDType(_IntEnum):
223 """See `nvmlUUIDType_t`."""
224 NONE = NVML_UUID_TYPE_NONE
225 ASCII = NVML_UUID_TYPE_ASCII
226 BINARY = NVML_UUID_TYPE_BINARY
228class EnableState(_IntEnum):
229 """See `nvmlEnableState_t`."""
230 FEATURE_DISABLED = NVML_FEATURE_DISABLED
231 FEATURE_ENABLED = NVML_FEATURE_ENABLED
233class BrandType(_IntEnum):
234 """See `nvmlBrandType_t`."""
235 BRAND_UNKNOWN = NVML_BRAND_UNKNOWN
236 BRAND_QUADRO = NVML_BRAND_QUADRO
237 BRAND_TESLA = NVML_BRAND_TESLA
238 BRAND_NVS = NVML_BRAND_NVS
239 BRAND_GRID = NVML_BRAND_GRID
240 BRAND_GEFORCE = NVML_BRAND_GEFORCE
241 BRAND_TITAN = NVML_BRAND_TITAN
242 BRAND_NVIDIA_VAPPS = NVML_BRAND_NVIDIA_VAPPS
243 BRAND_NVIDIA_VPC = NVML_BRAND_NVIDIA_VPC
244 BRAND_NVIDIA_VCS = NVML_BRAND_NVIDIA_VCS
245 BRAND_NVIDIA_VWS = NVML_BRAND_NVIDIA_VWS
246 BRAND_NVIDIA_CLOUD_GAMING = NVML_BRAND_NVIDIA_CLOUD_GAMING
247 BRAND_NVIDIA_VGAMING = NVML_BRAND_NVIDIA_VGAMING
248 BRAND_QUADRO_RTX = NVML_BRAND_QUADRO_RTX
249 BRAND_NVIDIA_RTX = NVML_BRAND_NVIDIA_RTX
250 BRAND_NVIDIA = NVML_BRAND_NVIDIA
251 BRAND_GEFORCE_RTX = NVML_BRAND_GEFORCE_RTX
252 BRAND_TITAN_RTX = NVML_BRAND_TITAN_RTX
253 BRAND_COUNT = NVML_BRAND_COUNT
255class TemperatureThresholds(_IntEnum):
256 """See `nvmlTemperatureThresholds_t`."""
257 TEMPERATURE_THRESHOLD_SHUTDOWN = NVML_TEMPERATURE_THRESHOLD_SHUTDOWN
258 TEMPERATURE_THRESHOLD_SLOWDOWN = NVML_TEMPERATURE_THRESHOLD_SLOWDOWN
259 TEMPERATURE_THRESHOLD_MEM_MAX = NVML_TEMPERATURE_THRESHOLD_MEM_MAX
260 TEMPERATURE_THRESHOLD_GPU_MAX = NVML_TEMPERATURE_THRESHOLD_GPU_MAX
261 TEMPERATURE_THRESHOLD_ACOUSTIC_MIN = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN
262 TEMPERATURE_THRESHOLD_ACOUSTIC_CURR = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR
263 TEMPERATURE_THRESHOLD_ACOUSTIC_MAX = NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX
264 TEMPERATURE_THRESHOLD_GPS_CURR = NVML_TEMPERATURE_THRESHOLD_GPS_CURR
265 TEMPERATURE_THRESHOLD_COUNT = NVML_TEMPERATURE_THRESHOLD_COUNT
267class TemperatureSensors(_IntEnum):
268 """See `nvmlTemperatureSensors_t`."""
269 TEMPERATURE_GPU = NVML_TEMPERATURE_GPU
270 TEMPERATURE_COUNT = NVML_TEMPERATURE_COUNT
272class ComputeMode(_IntEnum):
273 """See `nvmlComputeMode_t`."""
274 COMPUTEMODE_DEFAULT = NVML_COMPUTEMODE_DEFAULT
275 COMPUTEMODE_EXCLUSIVE_THREAD = NVML_COMPUTEMODE_EXCLUSIVE_THREAD
276 COMPUTEMODE_PROHIBITED = NVML_COMPUTEMODE_PROHIBITED
277 COMPUTEMODE_EXCLUSIVE_PROCESS = NVML_COMPUTEMODE_EXCLUSIVE_PROCESS
278 COMPUTEMODE_COUNT = NVML_COMPUTEMODE_COUNT
280class MemoryErrorType(_IntEnum):
281 """See `nvmlMemoryErrorType_t`."""
282 CORRECTED = NVML_MEMORY_ERROR_TYPE_CORRECTED
283 UNCORRECTED = NVML_MEMORY_ERROR_TYPE_UNCORRECTED
284 COUNT = NVML_MEMORY_ERROR_TYPE_COUNT
286class NvlinkVersion(_IntEnum):
287 """See `nvmlNvlinkVersion_t`."""
288 VERSION_INVALID = NVML_NVLINK_VERSION_INVALID
289 VERSION_1_0 = NVML_NVLINK_VERSION_1_0
290 VERSION_2_0 = NVML_NVLINK_VERSION_2_0
291 VERSION_2_2 = NVML_NVLINK_VERSION_2_2
292 VERSION_3_0 = NVML_NVLINK_VERSION_3_0
293 VERSION_3_1 = NVML_NVLINK_VERSION_3_1
294 VERSION_4_0 = NVML_NVLINK_VERSION_4_0
295 VERSION_5_0 = NVML_NVLINK_VERSION_5_0
297class EccCounterType(_IntEnum):
298 """See `nvmlEccCounterType_t`."""
299 VOLATILE_ECC = NVML_VOLATILE_ECC
300 AGGREGATE_ECC = NVML_AGGREGATE_ECC
301 COUNT = NVML_ECC_COUNTER_TYPE_COUNT
303class ClockType(_IntEnum):
304 """See `nvmlClockType_t`."""
305 CLOCK_GRAPHICS = NVML_CLOCK_GRAPHICS
306 CLOCK_SM = NVML_CLOCK_SM
307 CLOCK_MEM = NVML_CLOCK_MEM
308 CLOCK_VIDEO = NVML_CLOCK_VIDEO
309 CLOCK_COUNT = NVML_CLOCK_COUNT
311class ClockId(_IntEnum):
312 """See `nvmlClockId_t`."""
313 CURRENT = NVML_CLOCK_ID_CURRENT
314 APP_CLOCK_TARGET = NVML_CLOCK_ID_APP_CLOCK_TARGET
315 APP_CLOCK_DEFAULT = NVML_CLOCK_ID_APP_CLOCK_DEFAULT
316 CUSTOMER_BOOST_MAX = NVML_CLOCK_ID_CUSTOMER_BOOST_MAX
317 COUNT = NVML_CLOCK_ID_COUNT
319class DriverModel(_IntEnum):
320 """See `nvmlDriverModel_t`."""
321 DRIVER_WDDM = NVML_DRIVER_WDDM
322 DRIVER_WDM = NVML_DRIVER_WDM
323 DRIVER_MCDM = NVML_DRIVER_MCDM
325class Pstates(_IntEnum):
326 """See `nvmlPstates_t`."""
327 PSTATE_0 = NVML_PSTATE_0
328 PSTATE_1 = NVML_PSTATE_1
329 PSTATE_2 = NVML_PSTATE_2
330 PSTATE_3 = NVML_PSTATE_3
331 PSTATE_4 = NVML_PSTATE_4
332 PSTATE_5 = NVML_PSTATE_5
333 PSTATE_6 = NVML_PSTATE_6
334 PSTATE_7 = NVML_PSTATE_7
335 PSTATE_8 = NVML_PSTATE_8
336 PSTATE_9 = NVML_PSTATE_9
337 PSTATE_10 = NVML_PSTATE_10
338 PSTATE_11 = NVML_PSTATE_11
339 PSTATE_12 = NVML_PSTATE_12
340 PSTATE_13 = NVML_PSTATE_13
341 PSTATE_14 = NVML_PSTATE_14
342 PSTATE_15 = NVML_PSTATE_15
343 PSTATE_UNKNOWN = NVML_PSTATE_UNKNOWN
345class GpuOperationMode(_IntEnum):
346 """See `nvmlGpuOperationMode_t`."""
347 GOM_ALL_ON = NVML_GOM_ALL_ON
348 GOM_COMPUTE = NVML_GOM_COMPUTE
349 GOM_LOW_DP = NVML_GOM_LOW_DP
351class InforomObject(_IntEnum):
352 """See `nvmlInforomObject_t`."""
353 INFOROM_OEM = NVML_INFOROM_OEM
354 INFOROM_ECC = NVML_INFOROM_ECC
355 INFOROM_POWER = NVML_INFOROM_POWER
356 INFOROM_DEN = NVML_INFOROM_DEN
357 INFOROM_COUNT = NVML_INFOROM_COUNT
359class Return(_IntEnum):
360 """See `nvmlReturn_t`."""
361 SUCCESS = NVML_SUCCESS
362 ERROR_UNINITIALIZED = NVML_ERROR_UNINITIALIZED
363 ERROR_INVALID_ARGUMENT = NVML_ERROR_INVALID_ARGUMENT
364 ERROR_NOT_SUPPORTED = NVML_ERROR_NOT_SUPPORTED
365 ERROR_NO_PERMISSION = NVML_ERROR_NO_PERMISSION
366 ERROR_ALREADY_INITIALIZED = NVML_ERROR_ALREADY_INITIALIZED
367 ERROR_NOT_FOUND = NVML_ERROR_NOT_FOUND
368 ERROR_INSUFFICIENT_SIZE = NVML_ERROR_INSUFFICIENT_SIZE
369 ERROR_INSUFFICIENT_POWER = NVML_ERROR_INSUFFICIENT_POWER
370 ERROR_DRIVER_NOT_LOADED = NVML_ERROR_DRIVER_NOT_LOADED
371 ERROR_TIMEOUT = NVML_ERROR_TIMEOUT
372 ERROR_IRQ_ISSUE = NVML_ERROR_IRQ_ISSUE
373 ERROR_LIBRARY_NOT_FOUND = NVML_ERROR_LIBRARY_NOT_FOUND
374 ERROR_FUNCTION_NOT_FOUND = NVML_ERROR_FUNCTION_NOT_FOUND
375 ERROR_CORRUPTED_INFOROM = NVML_ERROR_CORRUPTED_INFOROM
376 ERROR_GPU_IS_LOST = NVML_ERROR_GPU_IS_LOST
377 ERROR_RESET_REQUIRED = NVML_ERROR_RESET_REQUIRED
378 ERROR_OPERATING_SYSTEM = NVML_ERROR_OPERATING_SYSTEM
379 ERROR_LIB_RM_VERSION_MISMATCH = NVML_ERROR_LIB_RM_VERSION_MISMATCH
380 ERROR_IN_USE = NVML_ERROR_IN_USE
381 ERROR_MEMORY = NVML_ERROR_MEMORY
382 ERROR_NO_DATA = NVML_ERROR_NO_DATA
383 ERROR_VGPU_ECC_NOT_SUPPORTED = NVML_ERROR_VGPU_ECC_NOT_SUPPORTED
384 ERROR_INSUFFICIENT_RESOURCES = NVML_ERROR_INSUFFICIENT_RESOURCES
385 ERROR_FREQ_NOT_SUPPORTED = NVML_ERROR_FREQ_NOT_SUPPORTED
386 ERROR_ARGUMENT_VERSION_MISMATCH = NVML_ERROR_ARGUMENT_VERSION_MISMATCH
387 ERROR_DEPRECATED = NVML_ERROR_DEPRECATED
388 ERROR_NOT_READY = NVML_ERROR_NOT_READY
389 ERROR_GPU_NOT_FOUND = NVML_ERROR_GPU_NOT_FOUND
390 ERROR_INVALID_STATE = NVML_ERROR_INVALID_STATE
391 ERROR_RESET_TYPE_NOT_SUPPORTED = NVML_ERROR_RESET_TYPE_NOT_SUPPORTED
392 ERROR_UNKNOWN = NVML_ERROR_UNKNOWN
394class MemoryLocation(_IntEnum):
395 """See `nvmlMemoryLocation_t`."""
396 L1_CACHE = NVML_MEMORY_LOCATION_L1_CACHE
397 L2_CACHE = NVML_MEMORY_LOCATION_L2_CACHE
398 DRAM = NVML_MEMORY_LOCATION_DRAM
399 DEVICE_MEMORY = NVML_MEMORY_LOCATION_DEVICE_MEMORY
400 REGISTER_FILE = NVML_MEMORY_LOCATION_REGISTER_FILE
401 TEXTURE_MEMORY = NVML_MEMORY_LOCATION_TEXTURE_MEMORY
402 TEXTURE_SHM = NVML_MEMORY_LOCATION_TEXTURE_SHM
403 CBU = NVML_MEMORY_LOCATION_CBU
404 SRAM = NVML_MEMORY_LOCATION_SRAM
405 COUNT = NVML_MEMORY_LOCATION_COUNT
407class PageRetirementCause(_IntEnum):
408 """See `nvmlPageRetirementCause_t`."""
409 MULTIPLE_SINGLE_BIT_ECC_ERRORS = NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS
410 DOUBLE_BIT_ECC_ERROR = NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR
411 COUNT = NVML_PAGE_RETIREMENT_CAUSE_COUNT
413class RestrictedAPI(_IntEnum):
414 """See `nvmlRestrictedAPI_t`."""
415 SET_APPLICATION_CLOCKS = NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS
416 SET_AUTO_BOOSTED_CLOCKS = NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS
417 COUNT = NVML_RESTRICTED_API_COUNT
419class GpuUtilizationDomainId(_IntEnum):
420 """See `nvmlGpuUtilizationDomainId_t`."""
421 GPU_UTILIZATION_DOMAIN_GPU = NVML_GPU_UTILIZATION_DOMAIN_GPU
422 GPU_UTILIZATION_DOMAIN_FB = NVML_GPU_UTILIZATION_DOMAIN_FB
423 GPU_UTILIZATION_DOMAIN_VID = NVML_GPU_UTILIZATION_DOMAIN_VID
424 GPU_UTILIZATION_DOMAIN_BUS = NVML_GPU_UTILIZATION_DOMAIN_BUS
426class GpuVirtualizationMode(_IntEnum):
427 """See `nvmlGpuVirtualizationMode_t`."""
428 NONE = NVML_GPU_VIRTUALIZATION_MODE_NONE
429 PASSTHROUGH = NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH
430 VGPU = NVML_GPU_VIRTUALIZATION_MODE_VGPU
431 HOST_VGPU = NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU
432 HOST_VSGA = NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA
434class HostVgpuMode(_IntEnum):
435 """See `nvmlHostVgpuMode_t`."""
436 NON_SRIOV = NVML_HOST_VGPU_MODE_NON_SRIOV
437 SRIOV = NVML_HOST_VGPU_MODE_SRIOV
439class VgpuVmIdType(_IntEnum):
440 """See `nvmlVgpuVmIdType_t`."""
441 VGPU_VM_ID_DOMAIN_ID = NVML_VGPU_VM_ID_DOMAIN_ID
442 VGPU_VM_ID_UUID = NVML_VGPU_VM_ID_UUID
444class VgpuGuestInfoState(_IntEnum):
445 """See `nvmlVgpuGuestInfoState_t`."""
446 VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED
447 VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED
449class GridLicenseFeatureCode(_IntEnum):
450 """See `nvmlGridLicenseFeatureCode_t`."""
451 UNKNOWN = NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN
452 VGPU = NVML_GRID_LICENSE_FEATURE_CODE_VGPU
453 NVIDIA_RTX = NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX
454 VWORKSTATION = NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION
455 GAMING = NVML_GRID_LICENSE_FEATURE_CODE_GAMING
456 COMPUTE = NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE
458class VgpuCapability(_IntEnum):
459 """See `nvmlVgpuCapability_t`."""
460 VGPU_CAP_NVLINK_P2P = NVML_VGPU_CAP_NVLINK_P2P
461 VGPU_CAP_GPUDIRECT = NVML_VGPU_CAP_GPUDIRECT
462 VGPU_CAP_MULTI_VGPU_EXCLUSIVE = NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE
463 VGPU_CAP_EXCLUSIVE_TYPE = NVML_VGPU_CAP_EXCLUSIVE_TYPE
464 VGPU_CAP_EXCLUSIVE_SIZE = NVML_VGPU_CAP_EXCLUSIVE_SIZE
465 VGPU_CAP_COUNT = NVML_VGPU_CAP_COUNT
467class VgpuDriverCapability(_IntEnum):
468 """See `nvmlVgpuDriverCapability_t`."""
469 VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU = NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU
470 VGPU_DRIVER_CAP_WARM_UPDATE = NVML_VGPU_DRIVER_CAP_WARM_UPDATE
471 VGPU_DRIVER_CAP_COUNT = NVML_VGPU_DRIVER_CAP_COUNT
473class DeviceVgpuCapability(_IntEnum):
474 """See `nvmlDeviceVgpuCapability_t`."""
475 DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU
476 DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES
477 DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES
478 DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW
479 DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW
480 DEVICE_VGPU_CAP_DEVICE_STREAMING = NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING
481 DEVICE_VGPU_CAP_MINI_QUARTER_GPU = NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU
482 DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU = NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU
483 DEVICE_VGPU_CAP_WARM_UPDATE = NVML_DEVICE_VGPU_CAP_WARM_UPDATE
484 DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS = NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS
485 DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED = NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED
486 DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED = NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED
487 DEVICE_VGPU_CAP_COUNT = NVML_DEVICE_VGPU_CAP_COUNT
489class DeviceGpuRecoveryAction(_IntEnum):
490 """See `nvmlDeviceGpuRecoveryAction_t`."""
491 GPU_RECOVERY_ACTION_NONE = NVML_GPU_RECOVERY_ACTION_NONE
492 GPU_RECOVERY_ACTION_GPU_RESET = NVML_GPU_RECOVERY_ACTION_GPU_RESET
493 GPU_RECOVERY_ACTION_NODE_REBOOT = NVML_GPU_RECOVERY_ACTION_NODE_REBOOT
494 GPU_RECOVERY_ACTION_DRAIN_P2P = NVML_GPU_RECOVERY_ACTION_DRAIN_P2P
495 GPU_RECOVERY_ACTION_DRAIN_AND_RESET = NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET
497class FanState(_IntEnum):
498 """See `nvmlFanState_t`."""
499 FAN_NORMAL = NVML_FAN_NORMAL
500 FAN_FAILED = NVML_FAN_FAILED
502class LedColor(_IntEnum):
503 """See `nvmlLedColor_t`."""
504 GREEN = NVML_LED_COLOR_GREEN
505 AMBER = NVML_LED_COLOR_AMBER
507class EncoderType(_IntEnum):
508 """See `nvmlEncoderType_t`."""
509 ENCODER_QUERY_H264 = NVML_ENCODER_QUERY_H264
510 ENCODER_QUERY_HEVC = NVML_ENCODER_QUERY_HEVC
511 ENCODER_QUERY_AV1 = NVML_ENCODER_QUERY_AV1
512 ENCODER_QUERY_UNKNOWN = NVML_ENCODER_QUERY_UNKNOWN
514class FBCSessionType(_IntEnum):
515 """See `nvmlFBCSessionType_t`."""
516 UNKNOWN = NVML_FBC_SESSION_TYPE_UNKNOWN
517 TOSYS = NVML_FBC_SESSION_TYPE_TOSYS
518 CUDA = NVML_FBC_SESSION_TYPE_CUDA
519 VID = NVML_FBC_SESSION_TYPE_VID
520 HWENC = NVML_FBC_SESSION_TYPE_HWENC
522class DetachGpuState(_IntEnum):
523 """See `nvmlDetachGpuState_t`."""
524 DETACH_GPU_KEEP = NVML_DETACH_GPU_KEEP
525 DETACH_GPU_REMOVE = NVML_DETACH_GPU_REMOVE
527class PcieLinkState(_IntEnum):
528 """See `nvmlPcieLinkState_t`."""
529 PCIE_LINK_KEEP = NVML_PCIE_LINK_KEEP
530 PCIE_LINK_SHUT_DOWN = NVML_PCIE_LINK_SHUT_DOWN
532class ClockLimitId(_IntEnum):
533 """See `nvmlClockLimitId_t`."""
534 RANGE_START = NVML_CLOCK_LIMIT_ID_RANGE_START
535 TDP = NVML_CLOCK_LIMIT_ID_TDP
536 UNLIMITED = NVML_CLOCK_LIMIT_ID_UNLIMITED
538class VgpuVmCompatibility(_IntEnum):
539 """See `nvmlVgpuVmCompatibility_t`."""
540 NONE = NVML_VGPU_VM_COMPATIBILITY_NONE
541 COLD = NVML_VGPU_VM_COMPATIBILITY_COLD
542 HIBERNATE = NVML_VGPU_VM_COMPATIBILITY_HIBERNATE
543 SLEEP = NVML_VGPU_VM_COMPATIBILITY_SLEEP
544 LIVE = NVML_VGPU_VM_COMPATIBILITY_LIVE
546class VgpuPgpuCompatibilityLimitCode(_IntEnum):
547 """See `nvmlVgpuPgpuCompatibilityLimitCode_t`."""
548 VGPU_COMPATIBILITY_LIMIT_NONE = NVML_VGPU_COMPATIBILITY_LIMIT_NONE
549 VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER = NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER
550 VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER = NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER
551 VGPU_COMPATIBILITY_LIMIT_GPU = NVML_VGPU_COMPATIBILITY_LIMIT_GPU
552 VGPU_COMPATIBILITY_LIMIT_OTHER = NVML_VGPU_COMPATIBILITY_LIMIT_OTHER
554class GpmMetricId(_IntEnum):
555 """See `nvmlGpmMetricId_t`."""
556 GPM_METRIC_GRAPHICS_UTIL = NVML_GPM_METRIC_GRAPHICS_UTIL
557 GPM_METRIC_SM_UTIL = NVML_GPM_METRIC_SM_UTIL
558 GPM_METRIC_SM_OCCUPANCY = NVML_GPM_METRIC_SM_OCCUPANCY
559 GPM_METRIC_INTEGER_UTIL = NVML_GPM_METRIC_INTEGER_UTIL
560 GPM_METRIC_ANY_TENSOR_UTIL = NVML_GPM_METRIC_ANY_TENSOR_UTIL
561 GPM_METRIC_DFMA_TENSOR_UTIL = NVML_GPM_METRIC_DFMA_TENSOR_UTIL
562 GPM_METRIC_HMMA_TENSOR_UTIL = NVML_GPM_METRIC_HMMA_TENSOR_UTIL
563 GPM_METRIC_IMMA_TENSOR_UTIL = NVML_GPM_METRIC_IMMA_TENSOR_UTIL
564 GPM_METRIC_DRAM_BW_UTIL = NVML_GPM_METRIC_DRAM_BW_UTIL
565 GPM_METRIC_FP64_UTIL = NVML_GPM_METRIC_FP64_UTIL
566 GPM_METRIC_FP32_UTIL = NVML_GPM_METRIC_FP32_UTIL
567 GPM_METRIC_FP16_UTIL = NVML_GPM_METRIC_FP16_UTIL
568 GPM_METRIC_PCIE_TX_PER_SEC = NVML_GPM_METRIC_PCIE_TX_PER_SEC
569 GPM_METRIC_PCIE_RX_PER_SEC = NVML_GPM_METRIC_PCIE_RX_PER_SEC
570 GPM_METRIC_NVDEC_0_UTIL = NVML_GPM_METRIC_NVDEC_0_UTIL
571 GPM_METRIC_NVDEC_1_UTIL = NVML_GPM_METRIC_NVDEC_1_UTIL
572 GPM_METRIC_NVDEC_2_UTIL = NVML_GPM_METRIC_NVDEC_2_UTIL
573 GPM_METRIC_NVDEC_3_UTIL = NVML_GPM_METRIC_NVDEC_3_UTIL
574 GPM_METRIC_NVDEC_4_UTIL = NVML_GPM_METRIC_NVDEC_4_UTIL
575 GPM_METRIC_NVDEC_5_UTIL = NVML_GPM_METRIC_NVDEC_5_UTIL
576 GPM_METRIC_NVDEC_6_UTIL = NVML_GPM_METRIC_NVDEC_6_UTIL
577 GPM_METRIC_NVDEC_7_UTIL = NVML_GPM_METRIC_NVDEC_7_UTIL
578 GPM_METRIC_NVJPG_0_UTIL = NVML_GPM_METRIC_NVJPG_0_UTIL
579 GPM_METRIC_NVJPG_1_UTIL = NVML_GPM_METRIC_NVJPG_1_UTIL
580 GPM_METRIC_NVJPG_2_UTIL = NVML_GPM_METRIC_NVJPG_2_UTIL
581 GPM_METRIC_NVJPG_3_UTIL = NVML_GPM_METRIC_NVJPG_3_UTIL
582 GPM_METRIC_NVJPG_4_UTIL = NVML_GPM_METRIC_NVJPG_4_UTIL
583 GPM_METRIC_NVJPG_5_UTIL = NVML_GPM_METRIC_NVJPG_5_UTIL
584 GPM_METRIC_NVJPG_6_UTIL = NVML_GPM_METRIC_NVJPG_6_UTIL
585 GPM_METRIC_NVJPG_7_UTIL = NVML_GPM_METRIC_NVJPG_7_UTIL
586 GPM_METRIC_NVOFA_0_UTIL = NVML_GPM_METRIC_NVOFA_0_UTIL
587 GPM_METRIC_NVOFA_1_UTIL = NVML_GPM_METRIC_NVOFA_1_UTIL
588 GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC
589 GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC
590 GPM_METRIC_NVLINK_L0_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC
591 GPM_METRIC_NVLINK_L0_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC
592 GPM_METRIC_NVLINK_L1_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC
593 GPM_METRIC_NVLINK_L1_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC
594 GPM_METRIC_NVLINK_L2_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC
595 GPM_METRIC_NVLINK_L2_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC
596 GPM_METRIC_NVLINK_L3_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC
597 GPM_METRIC_NVLINK_L3_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC
598 GPM_METRIC_NVLINK_L4_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC
599 GPM_METRIC_NVLINK_L4_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC
600 GPM_METRIC_NVLINK_L5_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC
601 GPM_METRIC_NVLINK_L5_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC
602 GPM_METRIC_NVLINK_L6_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC
603 GPM_METRIC_NVLINK_L6_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC
604 GPM_METRIC_NVLINK_L7_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC
605 GPM_METRIC_NVLINK_L7_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC
606 GPM_METRIC_NVLINK_L8_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC
607 GPM_METRIC_NVLINK_L8_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC
608 GPM_METRIC_NVLINK_L9_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC
609 GPM_METRIC_NVLINK_L9_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC
610 GPM_METRIC_NVLINK_L10_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC
611 GPM_METRIC_NVLINK_L10_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC
612 GPM_METRIC_NVLINK_L11_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC
613 GPM_METRIC_NVLINK_L11_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC
614 GPM_METRIC_NVLINK_L12_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC
615 GPM_METRIC_NVLINK_L12_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC
616 GPM_METRIC_NVLINK_L13_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC
617 GPM_METRIC_NVLINK_L13_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC
618 GPM_METRIC_NVLINK_L14_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC
619 GPM_METRIC_NVLINK_L14_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC
620 GPM_METRIC_NVLINK_L15_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC
621 GPM_METRIC_NVLINK_L15_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC
622 GPM_METRIC_NVLINK_L16_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC
623 GPM_METRIC_NVLINK_L16_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC
624 GPM_METRIC_NVLINK_L17_RX_PER_SEC = NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC
625 GPM_METRIC_NVLINK_L17_TX_PER_SEC = NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC
626 GPM_METRIC_C2C_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC
627 GPM_METRIC_C2C_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC
628 GPM_METRIC_C2C_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC
629 GPM_METRIC_C2C_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC
630 GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC
631 GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC
632 GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC
633 GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC
634 GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC
635 GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC
636 GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC
637 GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC
638 GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC
639 GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC
640 GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC
641 GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC
642 GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC
643 GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC
644 GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC
645 GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC
646 GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC
647 GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC
648 GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC
649 GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC
650 GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC
651 GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC
652 GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC
653 GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC
654 GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC
655 GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC
656 GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC
657 GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC
658 GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC
659 GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC
660 GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC
661 GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC
662 GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC
663 GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC
664 GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC
665 GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC
666 GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC
667 GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC
668 GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC
669 GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC
670 GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC
671 GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC
672 GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC
673 GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC
674 GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC
675 GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC
676 GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC
677 GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC
678 GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC
679 GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC
680 GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC
681 GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC
682 GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC
683 GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC
684 GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC
685 GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC = NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC
686 GPM_METRIC_HOSTMEM_CACHE_HIT = NVML_GPM_METRIC_HOSTMEM_CACHE_HIT
687 GPM_METRIC_HOSTMEM_CACHE_MISS = NVML_GPM_METRIC_HOSTMEM_CACHE_MISS
688 GPM_METRIC_PEERMEM_CACHE_HIT = NVML_GPM_METRIC_PEERMEM_CACHE_HIT
689 GPM_METRIC_PEERMEM_CACHE_MISS = NVML_GPM_METRIC_PEERMEM_CACHE_MISS
690 GPM_METRIC_DRAM_CACHE_HIT = NVML_GPM_METRIC_DRAM_CACHE_HIT
691 GPM_METRIC_DRAM_CACHE_MISS = NVML_GPM_METRIC_DRAM_CACHE_MISS
692 GPM_METRIC_NVENC_0_UTIL = NVML_GPM_METRIC_NVENC_0_UTIL
693 GPM_METRIC_NVENC_1_UTIL = NVML_GPM_METRIC_NVENC_1_UTIL
694 GPM_METRIC_NVENC_2_UTIL = NVML_GPM_METRIC_NVENC_2_UTIL
695 GPM_METRIC_NVENC_3_UTIL = NVML_GPM_METRIC_NVENC_3_UTIL
696 GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED
697 GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE
698 GPM_METRIC_GR0_CTXSW_REQUESTS = NVML_GPM_METRIC_GR0_CTXSW_REQUESTS
699 GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ
700 GPM_METRIC_GR0_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT
701 GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED
702 GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE
703 GPM_METRIC_GR1_CTXSW_REQUESTS = NVML_GPM_METRIC_GR1_CTXSW_REQUESTS
704 GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ
705 GPM_METRIC_GR1_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT
706 GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED
707 GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE
708 GPM_METRIC_GR2_CTXSW_REQUESTS = NVML_GPM_METRIC_GR2_CTXSW_REQUESTS
709 GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ
710 GPM_METRIC_GR2_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT
711 GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED
712 GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE
713 GPM_METRIC_GR3_CTXSW_REQUESTS = NVML_GPM_METRIC_GR3_CTXSW_REQUESTS
714 GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ
715 GPM_METRIC_GR3_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT
716 GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED
717 GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE
718 GPM_METRIC_GR4_CTXSW_REQUESTS = NVML_GPM_METRIC_GR4_CTXSW_REQUESTS
719 GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ
720 GPM_METRIC_GR4_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT
721 GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED
722 GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE
723 GPM_METRIC_GR5_CTXSW_REQUESTS = NVML_GPM_METRIC_GR5_CTXSW_REQUESTS
724 GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ
725 GPM_METRIC_GR5_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT
726 GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED
727 GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE
728 GPM_METRIC_GR6_CTXSW_REQUESTS = NVML_GPM_METRIC_GR6_CTXSW_REQUESTS
729 GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ
730 GPM_METRIC_GR6_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT
731 GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED
732 GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE
733 GPM_METRIC_GR7_CTXSW_REQUESTS = NVML_GPM_METRIC_GR7_CTXSW_REQUESTS
734 GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ = NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ
735 GPM_METRIC_GR7_CTXSW_ACTIVE_PCT = NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT
736 GPM_METRIC_MAX = NVML_GPM_METRIC_MAX
738class PowerProfileType(_IntEnum):
739 """See `nvmlPowerProfileType_t`."""
740 POWER_PROFILE_MAX_P = NVML_POWER_PROFILE_MAX_P
741 POWER_PROFILE_MAX_Q = NVML_POWER_PROFILE_MAX_Q
742 POWER_PROFILE_COMPUTE = NVML_POWER_PROFILE_COMPUTE
743 POWER_PROFILE_MEMORY_BOUND = NVML_POWER_PROFILE_MEMORY_BOUND
744 POWER_PROFILE_NETWORK = NVML_POWER_PROFILE_NETWORK
745 POWER_PROFILE_BALANCED = NVML_POWER_PROFILE_BALANCED
746 POWER_PROFILE_LLM_INFERENCE = NVML_POWER_PROFILE_LLM_INFERENCE
747 POWER_PROFILE_LLM_TRAINING = NVML_POWER_PROFILE_LLM_TRAINING
748 POWER_PROFILE_RBM = NVML_POWER_PROFILE_RBM
749 POWER_PROFILE_DCPCIE = NVML_POWER_PROFILE_DCPCIE
750 POWER_PROFILE_HMMA_SPARSE = NVML_POWER_PROFILE_HMMA_SPARSE
751 POWER_PROFILE_HMMA_DENSE = NVML_POWER_PROFILE_HMMA_DENSE
752 POWER_PROFILE_SYNC_BALANCED = NVML_POWER_PROFILE_SYNC_BALANCED
753 POWER_PROFILE_HPC = NVML_POWER_PROFILE_HPC
754 POWER_PROFILE_MIG = NVML_POWER_PROFILE_MIG
755 POWER_PROFILE_MAX = NVML_POWER_PROFILE_MAX
757class DeviceAddressingModeType(_IntEnum):
758 """See `nvmlDeviceAddressingModeType_t`."""
759 DEVICE_ADDRESSING_MODE_NONE = NVML_DEVICE_ADDRESSING_MODE_NONE
760 DEVICE_ADDRESSING_MODE_HMM = NVML_DEVICE_ADDRESSING_MODE_HMM
761 DEVICE_ADDRESSING_MODE_ATS = NVML_DEVICE_ADDRESSING_MODE_ATS
763class PRMCounterId(_IntEnum):
764 """See `nvmlPRMCounterId_t`."""
765 NONE = NVML_PRM_COUNTER_ID_NONE
766 PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS
767 PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS
768 PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS
769 PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY = NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY
770 PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES = NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES
771 PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT = NVML_PRM_COUNTER_ID_PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT
772 PPCNT_PLR_RCV_CODES = NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODES
773 PPCNT_PLR_RCV_CODE_ERR = NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODE_ERR
774 PPCNT_PLR_RCV_UNCORRECTABLE_CODE = NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_UNCORRECTABLE_CODE
775 PPCNT_PLR_XMIT_CODES = NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_CODES
776 PPCNT_PLR_XMIT_RETRY_CODES = NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_CODES
777 PPCNT_PLR_XMIT_RETRY_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_EVENTS
778 PPCNT_PLR_SYNC_EVENTS = NVML_PRM_COUNTER_ID_PPCNT_PLR_SYNC_EVENTS
779 PPRM_OPER_RECOVERY = NVML_PRM_COUNTER_ID_PPRM_OPER_RECOVERY
781class PowerProfileOperation(_IntEnum):
782 """See `nvmlPowerProfileOperation_t`."""
783 CLEAR = NVML_POWER_PROFILE_OPERATION_CLEAR
784 SET = NVML_POWER_PROFILE_OPERATION_SET
785 SET_AND_OVERWRITE = NVML_POWER_PROFILE_OPERATION_SET_AND_OVERWRITE
786 MAX = NVML_POWER_PROFILE_OPERATION_MAX
789class AffinityScope(_IntEnum):
790 NODE = 0 # Scope of NUMA node for affinity queries
791 SOCKET = 1 # Scope of processor socket for affinity queries
794class FieldId(_IntEnum):
795 DEV_ECC_CURRENT = 1 # Current ECC mode. 1=Active. 0=Inactive
796 DEV_ECC_PENDING = 2 # Pending ECC mode. 1=Active. 0=Inactive
797 # ECC Count Totals
798 DEV_ECC_SBE_VOL_TOTAL = 3 # Total single bit volatile ECC errors
799 DEV_ECC_DBE_VOL_TOTAL = 4 # Total double bit volatile ECC errors
800 DEV_ECC_SBE_AGG_TOTAL = 5 # Total single bit aggregate (persistent) ECC errors
801 DEV_ECC_DBE_AGG_TOTAL = 6 # Total double bit aggregate (persistent) ECC errors
802 # Individual ECC locations
803 DEV_ECC_SBE_VOL_L1 = 7 # L1 cache single bit volatile ECC errors
804 DEV_ECC_DBE_VOL_L1 = 8 # L1 cache double bit volatile ECC errors
805 DEV_ECC_SBE_VOL_L2 = 9 # L2 cache single bit volatile ECC errors
806 DEV_ECC_DBE_VOL_L2 = 10 # L2 cache double bit volatile ECC errors
807 DEV_ECC_SBE_VOL_DEV = 11 # Device memory single bit volatile ECC errors
808 DEV_ECC_DBE_VOL_DEV = 12 # Device memory double bit volatile ECC errors
809 DEV_ECC_SBE_VOL_REG = 13 # Register file single bit volatile ECC errors
810 DEV_ECC_DBE_VOL_REG = 14 # Register file double bit volatile ECC errors
811 DEV_ECC_SBE_VOL_TEX = 15 # Texture memory single bit volatile ECC errors
812 DEV_ECC_DBE_VOL_TEX = 16 # Texture memory double bit volatile ECC errors
813 DEV_ECC_DBE_VOL_CBU = 17 # CBU double bit volatile ECC errors
814 DEV_ECC_SBE_AGG_L1 = 18 # L1 cache single bit aggregate (persistent) ECC errors
815 DEV_ECC_DBE_AGG_L1 = 19 # L1 cache double bit aggregate (persistent) ECC errors
816 DEV_ECC_SBE_AGG_L2 = 20 # L2 cache single bit aggregate (persistent) ECC errors
817 DEV_ECC_DBE_AGG_L2 = 21 # L2 cache double bit aggregate (persistent) ECC errors
818 DEV_ECC_SBE_AGG_DEV = 22 # Device memory single bit aggregate (persistent) ECC errors
819 DEV_ECC_DBE_AGG_DEV = 23 # Device memory double bit aggregate (persistent) ECC errors
820 DEV_ECC_SBE_AGG_REG = 24 # Register File single bit aggregate (persistent) ECC errors
821 DEV_ECC_DBE_AGG_REG = 25 # Register File double bit aggregate (persistent) ECC errors
822 DEV_ECC_SBE_AGG_TEX = 26 # Texture memory single bit aggregate (persistent) ECC errors
823 DEV_ECC_DBE_AGG_TEX = 27 # Texture memory double bit aggregate (persistent) ECC errors
824 DEV_ECC_DBE_AGG_CBU = 28 # CBU double bit aggregate ECC errors
826 # Page Retirement
827 DEV_RETIRED_SBE = 29 # Number of retired pages because of single bit errors
828 DEV_RETIRED_DBE = 30 # Number of retired pages because of double bit errors
829 DEV_RETIRED_PENDING = 31 # If any pages are pending retirement. 1=yes. 0=no.
832 # NVLink Flit Error Counters
833 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L0 = 32 # NVLink flow control CRC Error Counter for Lane 0
834 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L1 = 33 # NVLink flow control CRC Error Counter for Lane 1
835 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L2 = 34 # NVLink flow control CRC Error Counter for Lane 2
836 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L3 = 35 # NVLink flow control CRC Error Counter for Lane 3
837 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L4 = 36 # NVLink flow control CRC Error Counter for Lane 4
838 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L5 = 37 # NVLink flow control CRC Error Counter for Lane 5
839 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_TOTAL =38 # NVLink flow control CRC Error Counter total for all Lanes
841 # NVLink CRC Data Error Counters
842 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L0 = 39 # NVLink data CRC Error Counter for Lane 0
843 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L1 = 40 # NVLink data CRC Error Counter for Lane 1
844 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L2 = 41 # NVLink data CRC Error Counter for Lane 2
845 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L3 = 42 # NVLink data CRC Error Counter for Lane 3
846 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L4 = 43 # NVLink data CRC Error Counter for Lane 4
847 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L5 = 44 # NVLink data CRC Error Counter for Lane 5
848 DEV_NVLINK_CRC_DATA_ERROR_COUNT_TOTAL =45 # NvLink data CRC Error Counter total for all Lanes
851 # NVLink Replay Error Counters
852 DEV_NVLINK_REPLAY_ERROR_COUNT_L0 = 46 # NVLink Replay Error Counter for Lane 0
853 DEV_NVLINK_REPLAY_ERROR_COUNT_L1 = 47 # NVLink Replay Error Counter for Lane 1
854 DEV_NVLINK_REPLAY_ERROR_COUNT_L2 = 48 # NVLink Replay Error Counter for Lane 2
855 DEV_NVLINK_REPLAY_ERROR_COUNT_L3 = 49 # NVLink Replay Error Counter for Lane 3
856 DEV_NVLINK_REPLAY_ERROR_COUNT_L4 = 50 # NVLink Replay Error Counter for Lane 4
857 DEV_NVLINK_REPLAY_ERROR_COUNT_L5 = 51 # NVLink Replay Error Counter for Lane 5
858 DEV_NVLINK_REPLAY_ERROR_COUNT_TOTAL = 52 # NVLink Replay Error Counter total for all Lanes
860 # NVLink Recovery Error Counters
861 DEV_NVLINK_RECOVERY_ERROR_COUNT_L0 = 53 # NVLink Recovery Error Counter for Lane 0
862 DEV_NVLINK_RECOVERY_ERROR_COUNT_L1 = 54 # NVLink Recovery Error Counter for Lane 1
863 DEV_NVLINK_RECOVERY_ERROR_COUNT_L2 = 55 # NVLink Recovery Error Counter for Lane 2
864 DEV_NVLINK_RECOVERY_ERROR_COUNT_L3 = 56 # NVLink Recovery Error Counter for Lane 3
865 DEV_NVLINK_RECOVERY_ERROR_COUNT_L4 = 57 # NVLink Recovery Error Counter for Lane 4
866 DEV_NVLINK_RECOVERY_ERROR_COUNT_L5 = 58 # NVLink Recovery Error Counter for Lane 5
867 DEV_NVLINK_RECOVERY_ERROR_COUNT_TOTAL =59 # NVLink Recovery Error Counter total for all Lanes
869 # NvLink Bandwidth Counters
870 DEV_NVLINK_BANDWIDTH_C0_L0 = 60 # NVLink Bandwidth Counter for Counter Set 0, Lane 0
871 DEV_NVLINK_BANDWIDTH_C0_L1 = 61 # NVLink Bandwidth Counter for Counter Set 0, Lane 1
872 DEV_NVLINK_BANDWIDTH_C0_L2 = 62 # NVLink Bandwidth Counter for Counter Set 0, Lane 2
873 DEV_NVLINK_BANDWIDTH_C0_L3 = 63 # NVLink Bandwidth Counter for Counter Set 0, Lane 3
874 DEV_NVLINK_BANDWIDTH_C0_L4 = 64 # NVLink Bandwidth Counter for Counter Set 0, Lane 4
875 DEV_NVLINK_BANDWIDTH_C0_L5 = 65 # NVLink Bandwidth Counter for Counter Set 0, Lane 5
876 DEV_NVLINK_BANDWIDTH_C0_TOTAL = 66 # NVLink Bandwidth Counter Total for Counter Set 0, All Lanes
878 # NvLink Bandwidth Counters
879 DEV_NVLINK_BANDWIDTH_C1_L0 = 67 # NVLink Bandwidth Counter for Counter Set 1, Lane 0
880 DEV_NVLINK_BANDWIDTH_C1_L1 = 68 # NVLink Bandwidth Counter for Counter Set 1, Lane 1
881 DEV_NVLINK_BANDWIDTH_C1_L2 = 69 # NVLink Bandwidth Counter for Counter Set 1, Lane 2
882 DEV_NVLINK_BANDWIDTH_C1_L3 = 70 # NVLink Bandwidth Counter for Counter Set 1, Lane 3
883 DEV_NVLINK_BANDWIDTH_C1_L4 = 71 # NVLink Bandwidth Counter for Counter Set 1, Lane 4
884 DEV_NVLINK_BANDWIDTH_C1_L5 = 72 # NVLink Bandwidth Counter for Counter Set 1, Lane 5
885 DEV_NVLINK_BANDWIDTH_C1_TOTAL = 73 # NVLink Bandwidth Counter Total for Counter Set 1, All Lanes
887 # NVML Perf Policy Counters
888 DEV_PERF_POLICY_POWER = 74 # Perf Policy Counter for Power Policy
889 DEV_PERF_POLICY_THERMAL = 75 # Perf Policy Counter for Thermal Policy
890 DEV_PERF_POLICY_SYNC_BOOST = 76 # Perf Policy Counter for Sync boost Policy
891 DEV_PERF_POLICY_BOARD_LIMIT = 77 # Perf Policy Counter for Board Limit
892 DEV_PERF_POLICY_LOW_UTILIZATION = 78 # Perf Policy Counter for Low GPU Utilization Policy
893 DEV_PERF_POLICY_RELIABILITY = 79 # Perf Policy Counter for Reliability Policy
894 DEV_PERF_POLICY_TOTAL_APP_CLOCKS = 80 # Perf Policy Counter for Total App Clock Policy
895 DEV_PERF_POLICY_TOTAL_BASE_CLOCKS = 81 # Perf Policy Counter for Total Base Clocks Policy
897 # Memory temperatures
898 DEV_MEMORY_TEMP = 82 # Memory temperature for the device
900 # Energy Counter
901 DEV_TOTAL_ENERGY_CONSUMPTION =83 # Total energy consumption for the GPU in mJ since the driver was last reloaded
903 # NVLink Speed
904 DEV_NVLINK_SPEED_MBPS_L0 = 84 # NVLink Speed in MBps for Link 0
905 DEV_NVLINK_SPEED_MBPS_L1 = 85 # NVLink Speed in MBps for Link 1
906 DEV_NVLINK_SPEED_MBPS_L2 = 86 # NVLink Speed in MBps for Link 2
907 DEV_NVLINK_SPEED_MBPS_L3 = 87 # NVLink Speed in MBps for Link 3
908 DEV_NVLINK_SPEED_MBPS_L4 = 88 # NVLink Speed in MBps for Link 4
909 DEV_NVLINK_SPEED_MBPS_L5 = 89 # NVLink Speed in MBps for Link 5
910 DEV_NVLINK_SPEED_MBPS_COMMON =90 # Common NVLink Speed in MBps for active links
912 DEV_NVLINK_LINK_COUNT = 91 # Number of NVLinks present on the device
914 DEV_RETIRED_PENDING_SBE = 92 # If any pages are pending retirement due to SBE. 1=yes. 0=no.
915 DEV_RETIRED_PENDING_DBE = 93 # If any pages are pending retirement due to DBE. 1=yes. 0=no.
917 DEV_PCIE_REPLAY_COUNTER = 94 # PCIe replay counter
918 DEV_PCIE_REPLAY_ROLLOVER_COUNTER = 95 # PCIe replay rollover counter
920 # NVLink Flit Error Counters
921 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L6 = 96 # NVLink flow control CRC Error Counter for Lane 6
922 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L7 = 97 # NVLink flow control CRC Error Counter for Lane 7
923 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L8 = 98 # NVLink flow control CRC Error Counter for Lane 8
924 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L9 = 99 # NVLink flow control CRC Error Counter for Lane 9
925 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L10 = 100 # NVLink flow control CRC Error Counter for Lane 10
926 DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L11 = 101 # NVLink flow control CRC Error Counter for Lane 11
928 # NVLink CRC Data Error Counters
929 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L6 = 102 # NVLink data CRC Error Counter for Lane 6
930 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L7 = 103 # NVLink data CRC Error Counter for Lane 7
931 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L8 = 104 # NVLink data CRC Error Counter for Lane 8
932 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L9 = 105 # NVLink data CRC Error Counter for Lane 9
933 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L10 = 106 # NVLink data CRC Error Counter for Lane 10
934 DEV_NVLINK_CRC_DATA_ERROR_COUNT_L11 = 107 # NVLink data CRC Error Counter for Lane 11
936 # NVLink Replay Error Counters
937 DEV_NVLINK_REPLAY_ERROR_COUNT_L6 = 108 # NVLink Replay Error Counter for Lane 6
938 DEV_NVLINK_REPLAY_ERROR_COUNT_L7 = 109 # NVLink Replay Error Counter for Lane 7
939 DEV_NVLINK_REPLAY_ERROR_COUNT_L8 = 110 # NVLink Replay Error Counter for Lane 8
940 DEV_NVLINK_REPLAY_ERROR_COUNT_L9 = 111 # NVLink Replay Error Counter for Lane 9
941 DEV_NVLINK_REPLAY_ERROR_COUNT_L10 = 112 # NVLink Replay Error Counter for Lane 10
942 DEV_NVLINK_REPLAY_ERROR_COUNT_L11 = 113 # NVLink Replay Error Counter for Lane 11
944 # NVLink Recovery Error Counters
945 DEV_NVLINK_RECOVERY_ERROR_COUNT_L6 = 114 # NVLink Recovery Error Counter for Lane 6
946 DEV_NVLINK_RECOVERY_ERROR_COUNT_L7 = 115 # NVLink Recovery Error Counter for Lane 7
947 DEV_NVLINK_RECOVERY_ERROR_COUNT_L8 = 116 # NVLink Recovery Error Counter for Lane 8
948 DEV_NVLINK_RECOVERY_ERROR_COUNT_L9 = 117 # NVLink Recovery Error Counter for Lane 9
949 DEV_NVLINK_RECOVERY_ERROR_COUNT_L10 = 118 # NVLink Recovery Error Counter for Lane 10
950 DEV_NVLINK_RECOVERY_ERROR_COUNT_L11 = 119 # NVLink Recovery Error Counter for Lane 11
952 # NvLink Bandwidth Counters */
953 DEV_NVLINK_BANDWIDTH_C0_L6 = 120 # NVLink Bandwidth Counter for Counter Set 0, Lane 6
954 DEV_NVLINK_BANDWIDTH_C0_L7 = 121 # NVLink Bandwidth Counter for Counter Set 0, Lane 7
955 DEV_NVLINK_BANDWIDTH_C0_L8 = 122 # NVLink Bandwidth Counter for Counter Set 0, Lane 8
956 DEV_NVLINK_BANDWIDTH_C0_L9 = 123 # NVLink Bandwidth Counter for Counter Set 0, Lane 9
957 DEV_NVLINK_BANDWIDTH_C0_L10 = 124 # NVLink Bandwidth Counter for Counter Set 0, Lane 10
958 DEV_NVLINK_BANDWIDTH_C0_L11 = 125 # NVLink Bandwidth Counter for Counter Set 0, Lane 11
960 # NvLink Bandwidth Counters
961 DEV_NVLINK_BANDWIDTH_C1_L6 = 126 # NVLink Bandwidth Counter for Counter Set 1, Lane 6
962 DEV_NVLINK_BANDWIDTH_C1_L7 = 127 # NVLink Bandwidth Counter for Counter Set 1, Lane 7
963 DEV_NVLINK_BANDWIDTH_C1_L8 = 128 # NVLink Bandwidth Counter for Counter Set 1, Lane 8
964 DEV_NVLINK_BANDWIDTH_C1_L9 = 129 # NVLink Bandwidth Counter for Counter Set 1, Lane 9
965 DEV_NVLINK_BANDWIDTH_C1_L10 = 130 # NVLink Bandwidth Counter for Counter Set 1, Lane 10
966 DEV_NVLINK_BANDWIDTH_C1_L11 = 131 # NVLink Bandwidth Counter for Counter Set 1, Lane 11
968 # NVLink Speed
969 DEV_NVLINK_SPEED_MBPS_L6 = 132 # NVLink Speed in MBps for Link 6
970 DEV_NVLINK_SPEED_MBPS_L7 = 133 # NVLink Speed in MBps for Link 7
971 DEV_NVLINK_SPEED_MBPS_L8 = 134 # NVLink Speed in MBps for Link 8
972 DEV_NVLINK_SPEED_MBPS_L9 = 135 # NVLink Speed in MBps for Link 9
973 DEV_NVLINK_SPEED_MBPS_L10 = 136 # NVLink Speed in MBps for Link 10
974 DEV_NVLINK_SPEED_MBPS_L11 = 137 # NVLink Speed in MBps for Link 11
976 # NVLink throughput counters field values
977 DEV_NVLINK_THROUGHPUT_DATA_TX = 138 # NVLink TX Data throughput in KiB
978 DEV_NVLINK_THROUGHPUT_DATA_RX = 139 # NVLink RX Data throughput in KiB
979 DEV_NVLINK_THROUGHPUT_RAW_TX = 140 # NVLink TX Data + protocol overhead in KiB
980 DEV_NVLINK_THROUGHPUT_RAW_RX = 141 # NVLink RX Data + protocol overhead in KiB
982 # Row Remapper
983 DEV_REMAPPED_COR = 142 # Number of remapped rows due to correctable errors
984 DEV_REMAPPED_UNC = 143 # Number of remapped rows due to uncorrectable errors
985 DEV_REMAPPED_PENDING = 144 # If any rows are pending remapping. 1=yes 0=no
986 DEV_REMAPPED_FAILURE = 145 # If any rows failed to be remapped 1=yes 0=no
988 # Remote device NVLink ID
989 DEV_NVLINK_REMOTE_NVLINK_ID = 146 # Remote device NVLink ID
991 # NVSwitch: connected NVLink count
992 DEV_NVSWITCH_CONNECTED_LINK_COUNT = 147 # Number of NVLinks connected to NVSwitch
994 # NvLink ECC Data Error Counters
995 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L0 = 148 # NVLink data ECC Error Counter for Link 0
996 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L1 = 149 # NVLink data ECC Error Counter for Link 1
997 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L2 = 150 # NVLink data ECC Error Counter for Link 2
998 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L3 = 151 # NVLink data ECC Error Counter for Link 3
999 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L4 = 152 # NVLink data ECC Error Counter for Link 4
1000 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L5 = 153 # NVLink data ECC Error Counter for Link 5
1001 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L6 = 154 # NVLink data ECC Error Counter for Link 6
1002 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L7 = 155 # NVLink data ECC Error Counter for Link 7
1003 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L8 = 156 # NVLink data ECC Error Counter for Link 8
1004 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L9 = 157 # NVLink data ECC Error Counter for Link 9
1005 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L10 = 158 # NVLink data ECC Error Counter for Link 10
1006 DEV_NVLINK_ECC_DATA_ERROR_COUNT_L11 = 159 # NVLink data ECC Error Counter for Link 11
1007 DEV_NVLINK_ECC_DATA_ERROR_COUNT_TOTAL =160 # NVLink data ECC Error Counter total for all Links
1009 # NVLink Error Replay
1010 DEV_NVLINK_ERROR_DL_REPLAY = 161 # NVLink Replay Error Counter
1012 # NVLink Recovery Error Counter
1013 DEV_NVLINK_ERROR_DL_RECOVERY = 162 # NVLink Recovery Error Counter
1015 # NVLink Recovery Error CRC Counter
1016 DEV_NVLINK_ERROR_DL_CRC = 163 # NVLink CRC Error Counter
1019 # NVLink Speed, State and Version field id 164, 165, and 166
1020 DEV_NVLINK_GET_SPEED = 164 # NVLink Speed in MBps
1021 DEV_NVLINK_GET_STATE = 165 # NVLink State - Active,Inactive
1022 DEV_NVLINK_GET_VERSION = 166 # NVLink Version
1024 DEV_NVLINK_GET_POWER_STATE = 167 # NVLink Power state. 0=HIGH_SPEED 1=LOW_SPEED
1025 DEV_NVLINK_GET_POWER_THRESHOLD = 168 # NVLink length of idle period (units can be found from
1026 # DEV_NVLINK_GET_POWER_THRESHOLD_UNITS) before
1027 # transitioning links to sleep state
1029 DEV_PCIE_L0_TO_RECOVERY_COUNTER = 169 # Device PEX error recovery counter
1031 DEV_C2C_LINK_COUNT = 170 # Number of C2C Links present on the device
1032 DEV_C2C_LINK_GET_STATUS = 171 # C2C Link Status 0=INACTIVE 1=ACTIVE
1033 DEV_C2C_LINK_GET_MAX_BW = 172 # C2C Link Speed in MBps for active links
1035 DEV_PCIE_COUNT_CORRECTABLE_ERRORS = 173 # PCIe Correctable Errors Counter
1036 DEV_PCIE_COUNT_NAKS_RECEIVED = 174 # PCIe NAK Receive Counter
1037 DEV_PCIE_COUNT_RECEIVER_ERROR = 175 # PCIe Receiver Error Counter
1038 DEV_PCIE_COUNT_BAD_TLP = 176 # PCIe Bad TLP Counter
1039 DEV_PCIE_COUNT_NAKS_SENT = 177 # PCIe NAK Send Counter
1040 DEV_PCIE_COUNT_BAD_DLLP = 178 # PCIe Bad DLLP Counter
1041 DEV_PCIE_COUNT_NON_FATAL_ERROR = 179 # PCIe Non Fatal Error Counter
1042 DEV_PCIE_COUNT_FATAL_ERROR = 180 # PCIe Fatal Error Counter
1043 DEV_PCIE_COUNT_UNSUPPORTED_REQ = 181 # PCIe Unsupported Request Counter
1044 DEV_PCIE_COUNT_LCRC_ERROR = 182 # PCIe LCRC Error Counter
1045 DEV_PCIE_COUNT_LANE_ERROR = 183 # PCIe Per Lane Error Counter.
1047 DEV_IS_RESETLESS_MIG_SUPPORTED = 184 # Device's Restless MIG Capability
1049 DEV_POWER_AVERAGE = 185 # GPU power averaged over 1 sec interval, supported on Ampere (except GA100) or newer architectures.
1050 DEV_POWER_INSTANT = 186 # Current GPU power, supported on all architectures.
1051 DEV_POWER_MIN_LIMIT = 187 # Minimum power limit in milliwatts.
1052 DEV_POWER_MAX_LIMIT = 188 # Maximum power limit in milliwatts.
1053 DEV_POWER_DEFAULT_LIMIT = 189 # Default power limit in milliwatts (limit which device boots with).
1054 DEV_POWER_CURRENT_LIMIT = 190 # Limit currently enforced in milliwatts (This includes other limits set elsewhere. E.g. Out-of-band).
1055 DEV_ENERGY = 191 # Total energy consumption (in mJ) since the driver was last reloaded. Same as \ref DEV_TOTAL_ENERGY_CONSUMPTION for the GPU.
1056 DEV_POWER_REQUESTED_LIMIT = 192 # Power limit requested by NVML or any other userspace client.
1058 # GPU T.Limit temperature thresholds in degree Celsius
1059 DEV_TEMPERATURE_SHUTDOWN_TLIMIT = 193 # T.Limit temperature after which GPU may shut down for HW protection
1060 DEV_TEMPERATURE_SLOWDOWN_TLIMIT = 194 # T.Limit temperature after which GPU may begin HW slowdown
1061 DEV_TEMPERATURE_MEM_MAX_TLIMIT = 195 # T.Limit temperature after which GPU may begin SW slowdown due to memory temperature
1062 DEV_TEMPERATURE_GPU_MAX_TLIMIT = 196 # T.Limit temperature after which GPU may be throttled below base clock
1064 DEV_PCIE_COUNT_TX_BYTES = 197 # PCIe transmit bytes. Value can be wrapped.
1065 DEV_PCIE_COUNT_RX_BYTES = 198 # PCIe receive bytes. Value can be wrapped.
1067 DEV_IS_MIG_MODE_INDEPENDENT_MIG_QUERY_CAPABLE = 199 # MIG mode independent, MIG query capable device. 1=yes. 0=no.
1069 DEV_NVLINK_GET_POWER_THRESHOLD_MAX = 200 # Max Nvlink Power Threshold. See DEV_NVLINK_GET_POWER_THRESHOLD
1072 # NVLink counter field id 201-225
1073 DEV_NVLINK_COUNT_XMIT_PACKETS = 201 # Total Tx packets on the link in NVLink5
1074 DEV_NVLINK_COUNT_XMIT_BYTES = 202 # Total Tx bytes on the link in NVLink5
1075 DEV_NVLINK_COUNT_RCV_PACKETS = 203 # Total Rx packets on the link in NVLink5
1076 DEV_NVLINK_COUNT_RCV_BYTES = 204 # Total Rx bytes on the link in NVLink5
1077 DEV_NVLINK_COUNT_VL15_DROPPED = 205 # Deprecated, do not use
1078 DEV_NVLINK_COUNT_MALFORMED_PACKET_ERRORS = 206 # Number of packets Rx on a link where packets are malformed
1079 DEV_NVLINK_COUNT_BUFFER_OVERRUN_ERRORS = 207 # Number of packets that were discarded on Rx due to buffer overrun
1080 DEV_NVLINK_COUNT_RCV_ERRORS = 208 # Total number of packets with errors Rx on a link
1081 DEV_NVLINK_COUNT_RCV_REMOTE_ERRORS = 209 # Total number of packets Rx - stomp/EBP marker
1082 DEV_NVLINK_COUNT_RCV_GENERAL_ERRORS = 210 # Total number of packets Rx with header mismatch
1083 DEV_NVLINK_COUNT_LOCAL_LINK_INTEGRITY_ERRORS = 211 # Total number of times that the count of local errors exceeded a threshold
1084 DEV_NVLINK_COUNT_XMIT_DISCARDS = 212 # Total number of tx error packets that were discarded
1086 DEV_NVLINK_COUNT_LINK_RECOVERY_SUCCESSFUL_EVENTS =213 # Number of times link went from Up to recovery, succeeded and link came back up
1087 DEV_NVLINK_COUNT_LINK_RECOVERY_FAILED_EVENTS = 214 # Number of times link went from Up to recovery, failed and link was declared down
1088 DEV_NVLINK_COUNT_LINK_RECOVERY_EVENTS = 215 # Number of times link went from Up to recovery, irrespective of the result
1090 DEV_NVLINK_COUNT_RAW_BER_LANE0 = 216 # Deprecated, do not use
1091 DEV_NVLINK_COUNT_RAW_BER_LANE1 = 217 # Deprecated, do not use
1092 DEV_NVLINK_COUNT_RAW_BER = 218 # Deprecated, do not use
1093 DEV_NVLINK_COUNT_EFFECTIVE_ERRORS = 219 # Sum of the number of errors in each Nvlink packet
1095 # NVLink Effective BER
1096 DEV_NVLINK_COUNT_EFFECTIVE_BER = 220 # Effective BER for effective errors
1097 DEV_NVLINK_COUNT_SYMBOL_ERRORS = 221 # Number of errors in rx symbols
1099 # NVLink Symbol BER
1100 DEV_NVLINK_COUNT_SYMBOL_BER = 222 # BER for symbol errors
1102 DEV_NVLINK_GET_POWER_THRESHOLD_MIN = 223 # Min Nvlink Power Threshold. See DEV_NVLINK_GET_POWER_THRESHOLD
1103 DEV_NVLINK_GET_POWER_THRESHOLD_UNITS = 224 # Values are in the form NVML_NVLINK_LOW_POWER_THRESHOLD_UNIT_*
1104 DEV_NVLINK_GET_POWER_THRESHOLD_SUPPORTED = 225 # Determine if Nvlink Power Threshold feature is supported
1106 DEV_RESET_STATUS = 226 # Depracated, do not use (use DEV_GET_GPU_RECOVERY_ACTION instead)
1107 DEV_DRAIN_AND_RESET_STATUS = 227 # Deprecated, do not use (use DEV_GET_GPU_RECOVERY_ACTION instead)
1108 DEV_PCIE_OUTBOUND_ATOMICS_MASK = 228
1109 DEV_PCIE_INBOUND_ATOMICS_MASK = 229
1110 DEV_GET_GPU_RECOVERY_ACTION = 230 # GPU Recovery action - None/Reset/Reboot/Drain P2P/Drain and Reset
1111 DEV_C2C_LINK_ERROR_INTR = 231 # C2C Link CRC Error Counter
1112 DEV_C2C_LINK_ERROR_REPLAY = 232 # C2C Link Replay Error Counter
1113 DEV_C2C_LINK_ERROR_REPLAY_B2B = 233 # C2C Link Back to Back Replay Error Counter
1114 DEV_C2C_LINK_POWER_STATE = 234 # C2C Link Power state. See NVML_C2C_POWER_STATE_*
1116 # NVLink counter field id 235-250
1117 DEV_NVLINK_COUNT_FEC_HISTORY_0 = 235 # Count of symbol errors that are corrected - bin 0
1118 DEV_NVLINK_COUNT_FEC_HISTORY_1 = 236 # Count of symbol errors that are corrected - bin 1
1119 DEV_NVLINK_COUNT_FEC_HISTORY_2 = 237 # Count of symbol errors that are corrected - bin 2
1120 DEV_NVLINK_COUNT_FEC_HISTORY_3 = 238 # Count of symbol errors that are corrected - bin 3
1121 DEV_NVLINK_COUNT_FEC_HISTORY_4 = 239 # Count of symbol errors that are corrected - bin 4
1122 DEV_NVLINK_COUNT_FEC_HISTORY_5 = 240 # Count of symbol errors that are corrected - bin 5
1123 DEV_NVLINK_COUNT_FEC_HISTORY_6 = 241 # Count of symbol errors that are corrected - bin 6
1124 DEV_NVLINK_COUNT_FEC_HISTORY_7 = 242 # Count of symbol errors that are corrected - bin 7
1125 DEV_NVLINK_COUNT_FEC_HISTORY_8 = 243 # Count of symbol errors that are corrected - bin 8
1126 DEV_NVLINK_COUNT_FEC_HISTORY_9 = 244 # Count of symbol errors that are corrected - bin 9
1127 DEV_NVLINK_COUNT_FEC_HISTORY_10 = 245 # Count of symbol errors that are corrected - bin 10
1128 DEV_NVLINK_COUNT_FEC_HISTORY_11 = 246 # Count of symbol errors that are corrected - bin 11
1129 DEV_NVLINK_COUNT_FEC_HISTORY_12 = 247 # Count of symbol errors that are corrected - bin 12
1130 DEV_NVLINK_COUNT_FEC_HISTORY_13 = 248 # Count of symbol errors that are corrected - bin 13
1131 DEV_NVLINK_COUNT_FEC_HISTORY_14 = 249 # Count of symbol errors that are corrected - bin 14
1132 DEV_NVLINK_COUNT_FEC_HISTORY_15 = 250 # Count of symbol errors that are corrected - bin 15
1134 # Power Smoothing
1135 PWR_SMOOTHING_ENABLED = 251 # Enablement (0/DISABLED or 1/ENABLED)
1136 PWR_SMOOTHING_PRIV_LVL = 252 # Current privilege level
1137 PWR_SMOOTHING_IMM_RAMP_DOWN_ENABLED = 253 # Immediate ramp down enablement (0/DISABLED or 1/ENABLED)
1138 PWR_SMOOTHING_APPLIED_TMP_CEIL = 254 # Applied TMP ceiling value in Watts
1139 PWR_SMOOTHING_APPLIED_TMP_FLOOR = 255 # Applied TMP floor value in Watts
1140 PWR_SMOOTHING_MAX_PERCENT_TMP_FLOOR_SETTING = 256 # Max % TMP Floor value
1141 PWR_SMOOTHING_MIN_PERCENT_TMP_FLOOR_SETTING = 257 # Min % TMP Floor value
1142 PWR_SMOOTHING_HW_CIRCUITRY_PERCENT_LIFETIME_REMAINING = 258 # HW Circuitry % lifetime remaining
1143 PWR_SMOOTHING_MAX_NUM_PRESET_PROFILES = 259 # Max number of preset profiles
1144 PWR_SMOOTHING_PROFILE_PERCENT_TMP_FLOOR = 260 # % TMP floor for a given profile
1145 PWR_SMOOTHING_PROFILE_RAMP_UP_RATE = 261 # Ramp up rate in mW/s for a given profile
1146 PWR_SMOOTHING_PROFILE_RAMP_DOWN_RATE = 262 # Ramp down rate in mW/s for a given profile
1147 PWR_SMOOTHING_PROFILE_RAMP_DOWN_HYST_VAL = 263 # Ramp down hysteresis value in ms for a given profile
1148 PWR_SMOOTHING_ACTIVE_PRESET_PROFILE = 264 # Active preset profile number
1149 PWR_SMOOTHING_ADMIN_OVERRIDE_PERCENT_TMP_FLOOR = 265 # % TMP floor for a given profile
1150 PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_UP_RATE = 266 # Ramp up rate in mW/s for a given profile
1151 PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_DOWN_RATE = 267 # Ramp down rate in mW/s for a given profile
1152 PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_DOWN_HYST_VAL = 268 # Ramp down hysteresis value in ms for a given profile
1154 # Field values for Clock Throttle Reason Counters
1155 DEV_CLOCKS_EVENT_REASON_SW_POWER_CAP = DEV_PERF_POLICY_POWER # Throttling to not exceed currently set power limits in ns
1156 DEV_CLOCKS_EVENT_REASON_SYNC_BOOST = DEV_PERF_POLICY_SYNC_BOOST # Throttling to match minimum possible clock across Sync Boost Group in ns
1157 DEV_CLOCKS_EVENT_REASON_SW_THERM_SLOWDOWN = 269 # Throttling to ensure ((GPU temp < GPU Max Operating Temp) && (Memory Temp < Memory Max Operating Temp)) in ns
1158 DEV_CLOCKS_EVENT_REASON_HW_THERM_SLOWDOWN = 270 # Throttling due to temperature being too high (reducing core clocks by a factor of 2 or more) in ns
1159 DEV_CLOCKS_EVENT_REASON_HW_POWER_BRAKE_SLOWDOWN = 271 # Throttling due to external power brake assertion trigger (reducing core clocks by a factor of 2 or more) in ns
1160 DEV_POWER_SYNC_BALANCING_FREQ = 272 # Accumulated frequency of the GPU to be used for averaging
1161 DEV_POWER_SYNC_BALANCING_AF = 273 # Accumulated activity factor of the GPU to be used for averaging
1162 DEV_EDPP_MULTIPLIER = 274 # EDPp multiplier expressed as a percentage
1164 PWR_SMOOTHING_PRIMARY_POWER_FLOOR = 275 # Current primary power floor value in Watts
1165 PWR_SMOOTHING_SECONDARY_POWER_FLOOR = 276 # Current secondary power floor value in Watts
1166 PWR_SMOOTHING_MIN_PRIMARY_FLOOR_ACT_OFFSET = 277 # Minimum primary floor activation offset value in Watts
1167 PWR_SMOOTHING_MIN_PRIMARY_FLOOR_ACT_POINT = 278 # Minimum primary floor activation point value in Watts
1168 PWR_SMOOTHING_WINDOW_MULTIPLIER = 279 # Window Multiplier value in ms
1169 PWR_SMOOTHING_DELAYED_PWR_SMOOTHING_SUPPORTED = 280 # Support (0/Not Supported or 1/Supported) for delayed power smoothing
1170 PWR_SMOOTHING_PROFILE_SECONDARY_POWER_FLOOR = 281 # Current secondary power floor value in Watts for a given profile
1171 PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_ACT_WIN_MULT = 282 # Current primary floor activation window multiplier value for a given profile
1172 PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_TAR_WIN_MULT = 283 # Current primary floor target window multiplier value for a given profile
1173 PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_ACT_OFFSET = 284 # Current primary floor activation offset value in Watts for a given profile
1174 PWR_SMOOTHING_ADMIN_OVERRIDE_SECONDARY_POWER_FLOOR = 285 # Current secondary power floor value in Watts for admin override
1175 PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_ACT_WIN_MULT = 286 # Current primary floor activation window multiplier value for admin override
1176 PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_TAR_WIN_MULT = 287 # Current primary floor target window multiplier value for admin override
1177 PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_ACT_OFFSET = 288 # Current primary floor activation offset value in Watts for admin override
1179 MAX = 289
1181NVLINK_MAX_LINKS = 18
1184class RUSD(_IntEnum):
1185 POLL_NONE = 0x0 # Disable RUSD polling on all metric groups
1186 POLL_CLOCK = 0x1 # Enable RUSD polling on clock group
1187 POLL_PERF = 0x2 # Enable RUSD polling on performance group
1188 POLL_MEMORY = 0x4 # Enable RUSD polling on memory group
1189 POLL_POWER = 0x8 # Enable RUSD polling on power group
1190 POLL_THERMAL = 0x10 # Enable RUSD polling on thermal group
1191 POLL_PCI = 0x20 # Enable RUSD polling on pci group
1192 POLL_FAN = 0x40 # Enable RUSD polling on fan group
1193 POLL_PROC_UTIL = 0x80 # Enable RUSD polling on process utilization group
1194 POLL_ALL = 0xFFFFFFFFFFFFFFFF # Enable RUSD polling on all groups
1197class PowerMizerMode(_IntEnum):
1198 ADAPTIVE = 0 # Adjust GPU clocks based on GPU utilization
1199 PREFER_MAXIMUM_PERFORMANCE = 1 # Raise GPU clocks to favor maximum performance, to the extent that thermal and other constraints allow
1200 AUTO = 2 # PowerMizer mode is driver controlled
1201 PREFER_CONSISTENT_PERFORMANCE = 3 # lock to GPU base clocks
1204class DeviceArch(_IntEnum):
1205 KEPLER = 2
1206 MAXWELL = 3
1207 PASCAL = 4
1208 VOLTA = 5
1209 TURING = 6
1210 AMPERE = 7
1211 ADA = 8
1212 HOPPER = 9
1213 BLACKWELL = 10
1214 UNKNOWN = 0xFFFFFFFF
1217class BusType(_IntEnum):
1218 UNKNOWN = 0
1219 PCI = 1
1220 PCIE = 2
1221 FPCI = 3
1222 AGP = 4
1225class FanControlPolicy(_IntEnum):
1226 TEMPERATURE_CONTINUOUS_SW = 0 # Temperature-controlled fan policy
1227 MANUAL = 1 # Manual fan control policy
1230class PowerSource(_IntEnum):
1231 AC = 0x00000000
1232 BATTERY = 0x00000001
1233 UNDERSIZED = 0x00000002
1236class PcieLinkMaxSpeed(_IntEnum):
1237 SPEED_INVALID = 0x00000000
1238 SPEED_2500MBPS = 0x00000001
1239 SPEED_5000MBPS = 0x00000002
1240 SPEED_8000MBPS = 0x00000003
1241 SPEED_16000MBPS = 0x00000004
1242 SPEED_32000MBPS = 0x00000005
1243 SPEED_64000MBPS = 0x00000006
1246class AdaptiveClockingInfoStatus(_IntEnum):
1247 DISABLED = 0x00000000
1248 ENABLED = 0x00000001
1251MAX_GPU_UTILIZATIONS = 8
1254class PcieAtomicsCap(_IntEnum):
1255 FETCHADD32 = 0x01
1256 FETCHADD64 = 0x02
1257 SWAP32 = 0x04
1258 SWAP64 = 0x08
1259 CAS32 = 0x10
1260 CAS64 = 0x20
1261 CAS128 = 0x40
1262 MAX = 7
1265class PowerScope(_IntEnum):
1266 GPU = 0
1267 MODULE = 1
1268 MEMORY = 2
1271# Need "Enum" suffix to disambiguate from nvmlGridLicenseExpiry_t
1272class GridLicenseExpiryEnum(_IntEnum):
1273 NOT_AVAILABLE = 0
1274 INVALID = 1
1275 VALID = 2
1276 NOT_APPLICABLE = 3
1277 PERMANENT = 4
1280GRID_LICENSE_FEATURE_MAX_COUNT = 3
1283class VgpuVirtualizationCapMigration(_IntEnum):
1284 NO = 0x0
1285 YES = 0x1
1288class VgpuPgpuVirtualizationCapMigration(_IntEnum):
1289 NO = 0x0
1290 YES = 0x1
1293class VgpuSchedulerPolicy(_IntEnum):
1294 UNKNOWN = 0
1295 BEST_EFFORT = 1
1296 EQUAL_SHARE = 2
1297 FIXED_SHARE = 3
1300class VgpuSchedulerArr(_IntEnum):
1301 DEFAULT = 0
1302 DISABLE = 1
1303 ENABLE = 2
1306class VgpuSchedulerEngineType(_IntEnum):
1307 GRAPHICS = 1
1308 NVENC1 = 2
1311class GridLicenseState(_IntEnum):
1312 UNKNOWN = 0
1313 UNINITIALIZED = 1
1314 UNLICENSED_UNRESTRICTED = 2
1315 UNLICENSED_RESTRICTED = 3
1316 UNLICENSED = 4
1317 LICENSED = 5
1320class NvlinkLowPowerThresholdUnit(_IntEnum):
1321 UNIT_100US = 0x0
1322 UNIT_50US = 0x1
1325class NvlinkPowerState(_IntEnum):
1326 HIGH_SPEED = 0x0
1327 LOW_SPEED = 0x1
1330class NvlinkLowPowerThreshold(_IntEnum):
1331 MIN = 0x1
1332 MAX = 0x1FFF
1333 RESET = 0xFFFFFFFF
1334 DEFAULT = 0xFFFFFFFF
1337class C2CPowerState(_IntEnum):
1338 FULL_POWER = 0
1339 LOW_POWER = 1
1342class EventType(_IntEnum):
1343 NONE = 0x0000000000000000
1344 SINGLE_BIT_ECC_ERROR = 0x0000000000000001
1345 DOUBLE_BIT_ECC_ERROR = 0x0000000000000002
1346 PSTATE = 0x0000000000000004
1347 XID_CRITICAL_ERROR = 0x0000000000000008
1348 CLOCK = 0x0000000000000010
1349 POWER_SOURCE_CHANGE = 0x0000000000000080
1350 MIG_CONFIG_CHANGE = 0x0000000000000100
1351 SINGLE_BIT_ECC_ERROR_STORM = 0x0000000000000200
1352 DRAM_RETIREMENT_EVENT = 0x0000000000000400
1353 DRAM_RETIREMENT_FAILURE = 0x0000000000000800
1354 NON_FATAL_POISON_ERROR = 0x0000000000001000
1355 FATAL_POISON_ERROR = 0x0000000000002000
1356 GPU_UNAVAILABLE_ERROR = 0x0000000000004000
1357 GPU_RECOVERY_ACTION = 0x0000000000008000
1360class SystemEventType(_IntEnum):
1361 GPU_DRIVER_UNBIND = 0x0000000000000001
1362 GPU_DRIVER_BIND = 0x0000000000000002
1365class ClocksEventReasons(_IntEnum):
1366 EVENT_REASON_GPU_IDLE = 0x0000000000000001
1367 EVENT_REASON_APPLICATIONS_CLOCKS_SETTING = 0x0000000000000002
1368 EVENT_REASON_SW_POWER_CAP = 0x0000000000000004
1369 THROTTLE_REASON_HW_SLOWDOWN = 0x0000000000000008
1370 EVENT_REASON_SYNC_BOOST = 0x0000000000000010
1371 EVENT_REASON_SW_THERMAL_SLOWDOWN = 0x0000000000000020
1372 THROTTLE_REASON_HW_THERMAL_SLOWDOWN = 0x0000000000000040
1373 THROTTLE_REASON_HW_POWER_BRAKE_SLOWDOWN = 0x0000000000000080
1374 EVENT_REASON_DISPLAY_CLOCK_SETTING = 0x0000000000000100
1375 EVENT_REASON_NONE = 0x0000000000000000
1378class EncoderQuery(_IntEnum):
1379 H264 = 0x00
1380 HEVC = 0x01
1381 AV1 = 0x02
1382 UNKNOWN = 0xFF
1385class NvFBCSessionFlag(_IntEnum):
1386 DIFFMAP_ENABLED = 0x00000001
1387 CLASSIFICATIONMAP_ENABLED = 0x00000002
1388 CAPTURE_WITH_WAIT_NO_WAIT = 0x00000004
1389 CAPTURE_WITH_WAIT_INFINITE = 0x00000008
1390 CAPTURE_WITH_WAIT_TIMEOUT = 0x00000010
1393class CCSystemCpuCaps(_IntEnum):
1394 NONE = 0
1395 AMD_SEV = 1
1396 INTEL_TDX = 2
1397 AMD_SEV_SNP = 3
1398 AMD_SNP_VTOM = 4
1401class CCSystemGpus(_IntEnum):
1402 CC_NOT_CAPABLE = 0
1403 CC_CAPABLE = 1
1406class CCSystemDevtoolsMode(_IntEnum):
1407 OFF = 0
1408 ON = 1
1411class CCSystemEnvironment(_IntEnum):
1412 UNAVAILABLE = 0
1413 SIM = 1
1414 PROD = 2
1417class CCSystemFeature(_IntEnum):
1418 DISABLED = 0
1419 ENABLED = 1
1422class CCSystemMultiGpu(_IntEnum):
1423 NONE = 0
1424 PROTECTED_PCIE = 1
1425 NVLE = 2
1428class CCAcceptingClientRequests(_IntEnum):
1429 FALSE = 0
1430 TRUE = 1
1433class GpuFabricState(_IntEnum):
1434 NOT_SUPPORTED = 0
1435 NOT_STARTED = 1
1436 IN_PROGRESS = 2
1437 COMPLETED = 3
1440class GpuFabricHealthMaskDegradedBw(_IntEnum):
1441 NOT_SUPPORTED = 0
1442 TRUE = 1
1443 FALSE = 2
1446class GpuFabricHealthMaskRouteRecovery(_IntEnum):
1447 NOT_SUPPORTED = 0
1448 TRUE = 1
1449 FALSE = 2
1452class GpuFabricHealthMaskRouteUnhealthy(_IntEnum):
1453 NOT_SUPPORTED = 0
1454 TRUE = 1
1455 FALSE = 2
1458class GpuFabricHealthMaskAccessTimeout(_IntEnum):
1459 NOT_SUPPORTED = 0
1460 TRUE = 1
1461 FALSE = 2
1464class GpuFabricHealthMaskIncorrectConfiguration(_IntEnum):
1465 NOT_SUPPORTED = 0
1466 NONE = 1
1467 INCORRECT_SYSGUID = 2
1468 INCORRECT_CHASSIS_SN = 3
1469 NO_PARTITION = 4
1470 INSUFFICIENT_NVLINKS = 5
1471 INCOMPATIBLE_GPU_FW = 6
1472 INVALID_LOCATION = 7
1475class GpuFabricHealthSummary(_IntEnum):
1476 NOT_SUPPORTED = 0
1477 HEALTHY = 1
1478 UNHEALTHY = 2
1479 LIMITED_CAPACITY = 3
1482class InitFlag(_IntEnum):
1483 NO_GPUS = 1
1484 NO_ATTACH = 2
1487class NvlinkState(_IntEnum):
1488 INACTIVE = 0x0
1489 ACTIVE = 0x1
1490 SLEEP = 0x2
1493class NvlinkFirmwareUcodeType(_IntEnum):
1494 MSE = 0x1
1495 NETIR = 0x2
1496 NETIR_UPHY = 0x3
1497 NETIR_CLN = 0x4
1498 NETIR_DLN = 0x5
1501class DeviceMig(_IntEnum):
1502 DISABLE = 0
1503 ENABLE = 1
1506class GpuInstanceProfile(_IntEnum):
1507 PROFILE_1_SLICE = 0x0
1508 PROFILE_2_SLICE = 0x1
1509 PROFILE_3_SLICE = 0x2
1510 PROFILE_4_SLICE = 0x3
1511 PROFILE_7_SLICE = 0x4
1512 PROFILE_8_SLICE = 0x5
1513 PROFILE_6_SLICE = 0x6
1514 PROFILE_1_SLICE_REV1 = 0x7
1515 PROFILE_2_SLICE_REV1 = 0x8
1516 PROFILE_1_SLICE_REV2 = 0x9
1517 PROFILE_1_SLICE_GFX = 0x0A
1518 PROFILE_2_SLICE_GFX = 0x0B
1519 PROFILE_4_SLICE_GFX = 0x0C
1520 PROFILE_1_SLICE_NO_ME = 0x0D
1521 PROFILE_2_SLICE_NO_ME = 0x0E
1522 PROFILE_1_SLICE_ALL_ME = 0x0F
1523 PROFILE_2_SLICE_ALL_ME = 0x10
1524 PROFILE_COUNT = 0x11
1527class GpuInstanceProfileCaps(_IntEnum):
1528 P2P = 0x1
1529 GFX = 0x2
1532class ComputeInstanceProfileCaps(_IntEnum):
1533 GFX = 0x1
1536class ComputeInstanceProfile(_IntEnum):
1537 PROFILE_1_SLICE = 0x0
1538 PROFILE_2_SLICE = 0x1
1539 PROFILE_3_SLICE = 0x2
1540 PROFILE_4_SLICE = 0x3
1541 PROFILE_7_SLICE = 0x4
1542 PROFILE_8_SLICE = 0x5
1543 PROFILE_6_SLICE = 0x6
1544 PROFILE_1_SLICE_REV1 = 0x7
1545 PROFILE_COUNT = 0x8
1548class ComputeInstanceEngineProfile(_IntEnum):
1549 SHARED = 0x0
1550 COUNT = 0x1
1553class PowerSmoothingProfileParam(_IntEnum):
1554 PERCENT_TMP_FLOOR = 0
1555 RAMP_UP_RATE = 1
1556 RAMP_DOWN_RATE = 2
1557 RAMP_DOWN_HYSTERESIS = 3
1558 SECONDARY_POWER_FLOOR = 4
1559 PRIMARY_FLOOR_ACT_WIN_MULT = 5
1560 PRIMARY_FLOOR_TAR_WIN_MULT = 6
1561 PRIMARY_FLOOR_ACT_OFFSET = 7
1564class VgpuPgpu(_IntEnum):
1565 HETEROGENEOUS_MODE = 0 # Heterogeneous vGPU mode.
1566 HOMOGENEOUS_MODE = 1 # Homogeneous vGPU mode.
1569###############################################################################
1570# Error handling
1571###############################################################################
1574class NvmlError(Exception):
1575 def __init__(self, status):
1576 self.status = status 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1577 s = error_string(status) 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1578 super(NvmlError, self).__init__(s) 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1580 def __reduce__(self):
1581 return (type(self), (self.status,))
1584class UninitializedError(NvmlError):
1585 pass
1587class InvalidArgumentError(NvmlError):
1588 pass
1590class NotSupportedError(NvmlError):
1591 pass
1593class NoPermissionError(NvmlError):
1594 pass
1596class AlreadyInitializedError(NvmlError):
1597 pass
1599class NotFoundError(NvmlError):
1600 pass
1602class InsufficientSizeError(NvmlError):
1603 pass
1605class InsufficientPowerError(NvmlError):
1606 pass
1608class DriverNotLoadedError(NvmlError):
1609 pass
1611class TimeoutError(NvmlError):
1612 pass
1614class IrqIssueError(NvmlError):
1615 pass
1617class LibraryNotFoundError(NvmlError):
1618 pass
1620class FunctionNotFoundError(NvmlError):
1621 pass
1623class CorruptedInforomError(NvmlError):
1624 pass
1626class GpuIsLostError(NvmlError):
1627 pass
1629class ResetRequiredError(NvmlError):
1630 pass
1632class OperatingSystemError(NvmlError):
1633 pass
1635class LibRmVersionMismatchError(NvmlError):
1636 pass
1638class InUseError(NvmlError):
1639 pass
1641class MemoryError(NvmlError):
1642 pass
1644class NoDataError(NvmlError):
1645 pass
1647class VgpuEccNotSupportedError(NvmlError):
1648 pass
1650class InsufficientResourcesError(NvmlError):
1651 pass
1653class FreqNotSupportedError(NvmlError):
1654 pass
1656class ArgumentVersionMismatchError(NvmlError):
1657 pass
1659class DeprecatedError(NvmlError):
1660 pass
1662class NotReadyError(NvmlError):
1663 pass
1665class GpuNotFoundError(NvmlError):
1666 pass
1668class InvalidStateError(NvmlError):
1669 pass
1671class ResetTypeNotSupportedError(NvmlError):
1672 pass
1674class UnknownError(NvmlError):
1675 pass
1677cdef object _nvml_error_factory(int status):
1678 cdef object pystatus = status 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1679 if status == 1: 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1680 return UninitializedError(pystatus) 1X
1681 elif status == 2:
1682 return InvalidArgumentError(pystatus) 1b
1683 elif status == 3:
1684 return NotSupportedError(pystatus) 1HpINK8sOPQRSTiAjbkBn
1685 elif status == 4:
1686 return NoPermissionError(pystatus) 1WJV
1687 elif status == 5:
1688 return AlreadyInitializedError(pystatus)
1689 elif status == 6:
1690 return NotFoundError(pystatus)
1691 elif status == 7:
1692 return InsufficientSizeError(pystatus)
1693 elif status == 8:
1694 return InsufficientPowerError(pystatus)
1695 elif status == 9:
1696 return DriverNotLoadedError(pystatus)
1697 elif status == 10:
1698 return TimeoutError(pystatus) 1hl
1699 elif status == 11:
1700 return IrqIssueError(pystatus)
1701 elif status == 12:
1702 return LibraryNotFoundError(pystatus)
1703 elif status == 13:
1704 return FunctionNotFoundError(pystatus)
1705 elif status == 14:
1706 return CorruptedInforomError(pystatus)
1707 elif status == 15:
1708 return GpuIsLostError(pystatus)
1709 elif status == 16:
1710 return ResetRequiredError(pystatus)
1711 elif status == 17:
1712 return OperatingSystemError(pystatus)
1713 elif status == 18:
1714 return LibRmVersionMismatchError(pystatus)
1715 elif status == 19:
1716 return InUseError(pystatus)
1717 elif status == 20:
1718 return MemoryError(pystatus)
1719 elif status == 21:
1720 return NoDataError(pystatus)
1721 elif status == 22:
1722 return VgpuEccNotSupportedError(pystatus)
1723 elif status == 23:
1724 return InsufficientResourcesError(pystatus)
1725 elif status == 24:
1726 return FreqNotSupportedError(pystatus)
1727 elif status == 25:
1728 return ArgumentVersionMismatchError(pystatus)
1729 elif status == 26:
1730 return DeprecatedError(pystatus)
1731 elif status == 27:
1732 return NotReadyError(pystatus) 1g
1733 elif status == 28:
1734 return GpuNotFoundError(pystatus)
1735 elif status == 29:
1736 return InvalidStateError(pystatus)
1737 elif status == 30:
1738 return ResetTypeNotSupportedError(pystatus)
1739 elif status == 999:
1740 return UnknownError(pystatus) 1Czw
1741 return NvmlError(status)
1745@cython.profile(False)
1746cpdef int check_status(int status) except 1 nogil:
1747 if status != 0: 2a 4b5b6bW pbmcq nbqbncWbrbocXbsbpcobtbqcH ubrc0 vbscp wbtcMbxbucx ybvcI zbwcJ AbxcV BbycN CbzcDbAcC EbBcz FbCcG DcEcD GbFc7be Gc' HcIcX o HbJcK IbKc8 JbLcs KbMcw LbNc9 Oc: ; Pc= ? QcNbL SbTb4 Rc@ [ Sc] ^ TcF _ UcO ` VcP { WcQ | XcR } YcS ~ ZcT ab0cbb1ccb2cdb3ceb4cfb5cgb6chb7cObib8cPbjb9cQbkb!cU lb#cYb$c%c8b'c(cZb)c*c0b+c,ci E A j Y b ( ) k y * 9bZ + !br $ #bm c 1 % , 5 - d M g . 6 $b%b/ 7 B ! f h t n u l 'bUb(b)bRb1b2b*b3bVbv +b,b-b.b/b:b;b=b?b@b[b]b^b_b`b{b|b}b~bacbcccdcecfcgchcicjckclc
1748 with gil: 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1749 raise _nvml_error_factory(status) 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
1750 return status != 0 2a 4b5b6bW pbmcq nbqbncWbrbocXbsbpcobtbqcH ubrc0 vbscp wbtcMbxbucx ybvcI zbwcJ AbxcV BbycN CbzcDbAcC EbBcz FbCcG DcEcD GbFc7be Gc' HcIcX o HbJcK IbKcJbLcs KbMcw LbNc9 Oc: ; Pc= ? QcNbL SbTb4 Rc@ [ Sc] ^ TcF _ UcO ` VcP { WcQ | XcR } YcS ~ ZcT ab0cbb1ccb2cdb3ceb4cfb5cgb6chb7cObib8cPbjb9cQbkb!cU lb#cYb$c%c8b'c(cZb)c*c0b+c,ci E A j Y b ( ) k y * 9bZ + !br $ #bm c 1 % , 5 - d M g . 6 $b%b/ 7 B ! f h t n u l 'bUb(b)bRb1b2b*b3bVbv +b,b-b.b/b:b;b=b?b@b[b]b^b_b`b{b|b}b~bacbcccdcecfcgchcicjckclc
1753@cython.profile(False)
1754cpdef int check_status_size(int status) except 1 nogil:
1755 if status == nvmlReturn_t.NVML_ERROR_INSUFFICIENT_SIZE: 1K8M6
1756 return 0
1757 return check_status(status) 1K8M6
1760###############################################################################
1761# Wrapper functions
1762###############################################################################
1765cdef _get_pci_info_ext_v1_dtype_offsets():
1766 cdef nvmlPciInfoExt_v1_t pod = nvmlPciInfoExt_v1_t()
1767 return _numpy.dtype({
1768 'names': ['version', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'base_class', 'sub_class', 'bus_id'],
1769 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 32)],
1770 'offsets': [
1771 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
1772 (<intptr_t>&(pod.domain)) - (<intptr_t>&pod),
1773 (<intptr_t>&(pod.bus)) - (<intptr_t>&pod),
1774 (<intptr_t>&(pod.device)) - (<intptr_t>&pod),
1775 (<intptr_t>&(pod.pciDeviceId)) - (<intptr_t>&pod),
1776 (<intptr_t>&(pod.pciSubSystemId)) - (<intptr_t>&pod),
1777 (<intptr_t>&(pod.baseClass)) - (<intptr_t>&pod),
1778 (<intptr_t>&(pod.subClass)) - (<intptr_t>&pod),
1779 (<intptr_t>&(pod.busId)) - (<intptr_t>&pod),
1780 ],
1781 'itemsize': sizeof(nvmlPciInfoExt_v1_t),
1782 })
1784pci_info_ext_v1_dtype = _get_pci_info_ext_v1_dtype_offsets()
1786cdef class PciInfoExt_v1:
1787 """Empty-initialize an instance of `nvmlPciInfoExt_v1_t`.
1790 .. seealso:: `nvmlPciInfoExt_v1_t`
1791 """
1792 cdef:
1793 nvmlPciInfoExt_v1_t *_ptr
1794 object _owner
1795 bint _owned
1796 bint _readonly
1798 def __init__(self):
1799 self._ptr = <nvmlPciInfoExt_v1_t *>calloc(1, sizeof(nvmlPciInfoExt_v1_t)) 1mcuv
1800 if self._ptr == NULL: 1mcuv
1801 raise MemoryError("Error allocating PciInfoExt_v1")
1802 self._owner = None 1mcuv
1803 self._owned = True 1mcuv
1804 self._readonly = False 1mcuv
1806 def __dealloc__(self):
1807 cdef nvmlPciInfoExt_v1_t *ptr
1808 if self._owned and self._ptr != NULL: 1mcuv
1809 ptr = self._ptr 1mcuv
1810 self._ptr = NULL 1mcuv
1811 free(ptr) 1mcuv
1813 def __repr__(self):
1814 return f"<{__name__}.PciInfoExt_v1 object at {hex(id(self))}>"
1816 @property
1817 def ptr(self):
1818 """Get the pointer address to the data as Python :class:`int`."""
1819 return <intptr_t>(self._ptr)
1821 cdef intptr_t _get_ptr(self):
1822 return <intptr_t>(self._ptr) 1mcuv
1824 def __int__(self):
1825 return <intptr_t>(self._ptr)
1827 def __eq__(self, other):
1828 cdef PciInfoExt_v1 other_
1829 if not isinstance(other, PciInfoExt_v1):
1830 return False
1831 other_ = other
1832 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPciInfoExt_v1_t)) == 0)
1834 def __setitem__(self, key, val):
1835 if key == 0 and isinstance(val, _numpy.ndarray):
1836 self._ptr = <nvmlPciInfoExt_v1_t *>malloc(sizeof(nvmlPciInfoExt_v1_t))
1837 if self._ptr == NULL:
1838 raise MemoryError("Error allocating PciInfoExt_v1")
1839 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPciInfoExt_v1_t))
1840 self._owner = None
1841 self._owned = True
1842 self._readonly = not val.flags.writeable
1843 else:
1844 setattr(self, key, val)
1846 @property
1847 def version(self):
1848 """int: The version number of this struct."""
1849 return self._ptr[0].version
1851 @version.setter
1852 def version(self, val):
1853 if self._readonly:
1854 raise ValueError("This PciInfoExt_v1 instance is read-only")
1855 self._ptr[0].version = val
1857 @property
1858 def domain(self):
1859 """int: The PCI domain on which the device's bus resides, 0 to 0xffffffff."""
1860 return self._ptr[0].domain 1c
1862 @domain.setter
1863 def domain(self, val):
1864 if self._readonly:
1865 raise ValueError("This PciInfoExt_v1 instance is read-only")
1866 self._ptr[0].domain = val
1868 @property
1869 def bus(self):
1870 """int: The bus on which the device resides, 0 to 0xff."""
1871 return self._ptr[0].bus 1c
1873 @bus.setter
1874 def bus(self, val):
1875 if self._readonly:
1876 raise ValueError("This PciInfoExt_v1 instance is read-only")
1877 self._ptr[0].bus = val
1879 @property
1880 def device_(self):
1881 """int: The device's id on the bus, 0 to 31."""
1882 return self._ptr[0].device 1c
1884 @device_.setter
1885 def device_(self, val):
1886 if self._readonly:
1887 raise ValueError("This PciInfoExt_v1 instance is read-only")
1888 self._ptr[0].device = val
1890 @property
1891 def pci_device_id(self):
1892 """int: The combined 16-bit device id and 16-bit vendor id."""
1893 return self._ptr[0].pciDeviceId 1c
1895 @pci_device_id.setter
1896 def pci_device_id(self, val):
1897 if self._readonly:
1898 raise ValueError("This PciInfoExt_v1 instance is read-only")
1899 self._ptr[0].pciDeviceId = val
1901 @property
1902 def pci_sub_system_id(self):
1903 """int: The 32-bit Sub System Device ID."""
1904 return self._ptr[0].pciSubSystemId 1c
1906 @pci_sub_system_id.setter
1907 def pci_sub_system_id(self, val):
1908 if self._readonly:
1909 raise ValueError("This PciInfoExt_v1 instance is read-only")
1910 self._ptr[0].pciSubSystemId = val
1912 @property
1913 def base_class(self):
1914 """int: The 8-bit PCI base class code."""
1915 return self._ptr[0].baseClass 1c
1917 @base_class.setter
1918 def base_class(self, val):
1919 if self._readonly:
1920 raise ValueError("This PciInfoExt_v1 instance is read-only")
1921 self._ptr[0].baseClass = val
1923 @property
1924 def sub_class(self):
1925 """int: The 8-bit PCI sub class code."""
1926 return self._ptr[0].subClass 1c
1928 @sub_class.setter
1929 def sub_class(self, val):
1930 if self._readonly:
1931 raise ValueError("This PciInfoExt_v1 instance is read-only")
1932 self._ptr[0].subClass = val
1934 @property
1935 def bus_id(self):
1936 """~_numpy.int8: (array of length 32).The tuple domain:bus:device.function PCI identifier (& NULL terminator)"""
1937 return cpython.PyUnicode_FromString(self._ptr[0].busId) 1mcuv
1939 @bus_id.setter
1940 def bus_id(self, val):
1941 if self._readonly:
1942 raise ValueError("This PciInfoExt_v1 instance is read-only")
1943 cdef bytes buf = val.encode()
1944 if len(buf) >= 32:
1945 raise ValueError("String too long for field bus_id, max length is 31")
1946 cdef char *ptr = buf
1947 memcpy(<void *>(self._ptr[0].busId), <void *>ptr, 32)
1949 @staticmethod
1950 def from_data(data):
1951 """Create an PciInfoExt_v1 instance wrapping the given NumPy array.
1953 Args:
1954 data (_numpy.ndarray): a single-element array of dtype `pci_info_ext_v1_dtype` holding the data.
1955 """
1956 return __from_data(data, "pci_info_ext_v1_dtype", pci_info_ext_v1_dtype, PciInfoExt_v1)
1958 @staticmethod
1959 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
1960 """Create an PciInfoExt_v1 instance wrapping the given pointer.
1962 Args:
1963 ptr (intptr_t): pointer address as Python :class:`int` to the data.
1964 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
1965 readonly (bool): whether the data is read-only (to the user). default is `False`.
1966 """
1967 if ptr == 0:
1968 raise ValueError("ptr must not be null (0)")
1969 cdef PciInfoExt_v1 obj = PciInfoExt_v1.__new__(PciInfoExt_v1)
1970 if owner is None:
1971 obj._ptr = <nvmlPciInfoExt_v1_t *>malloc(sizeof(nvmlPciInfoExt_v1_t))
1972 if obj._ptr == NULL:
1973 raise MemoryError("Error allocating PciInfoExt_v1")
1974 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPciInfoExt_v1_t))
1975 obj._owner = None
1976 obj._owned = True
1977 else:
1978 obj._ptr = <nvmlPciInfoExt_v1_t *>ptr
1979 obj._owner = owner
1980 obj._owned = False
1981 obj._readonly = readonly
1982 return obj
1985cdef _get_pci_info_dtype_offsets():
1986 cdef nvmlPciInfo_t pod = nvmlPciInfo_t()
1987 return _numpy.dtype({
1988 'names': ['bus_id_legacy', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'bus_id'],
1989 'formats': [(_numpy.int8, 16), _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 32)],
1990 'offsets': [
1991 (<intptr_t>&(pod.busIdLegacy)) - (<intptr_t>&pod),
1992 (<intptr_t>&(pod.domain)) - (<intptr_t>&pod),
1993 (<intptr_t>&(pod.bus)) - (<intptr_t>&pod),
1994 (<intptr_t>&(pod.device)) - (<intptr_t>&pod),
1995 (<intptr_t>&(pod.pciDeviceId)) - (<intptr_t>&pod),
1996 (<intptr_t>&(pod.pciSubSystemId)) - (<intptr_t>&pod),
1997 (<intptr_t>&(pod.busId)) - (<intptr_t>&pod),
1998 ],
1999 'itemsize': sizeof(nvmlPciInfo_t),
2000 })
2002pci_info_dtype = _get_pci_info_dtype_offsets()
2004cdef class PciInfo:
2005 """Empty-initialize an instance of `nvmlPciInfo_t`.
2008 .. seealso:: `nvmlPciInfo_t`
2009 """
2010 cdef:
2011 nvmlPciInfo_t *_ptr
2012 object _owner
2013 bint _owned
2014 bint _readonly
2016 def __init__(self):
2017 self._ptr = <nvmlPciInfo_t *>calloc(1, sizeof(nvmlPciInfo_t)) 1qewL
2018 if self._ptr == NULL: 1qewL
2019 raise MemoryError("Error allocating PciInfo")
2020 self._owner = None 1qewL
2021 self._owned = True 1qewL
2022 self._readonly = False 1qewL
2024 def __dealloc__(self):
2025 cdef nvmlPciInfo_t *ptr
2026 if self._owned and self._ptr != NULL: 2q e Sb-c
2027 ptr = self._ptr 2q e Sb-c
2028 self._ptr = NULL 2q e Sb-c
2029 free(ptr) 2q e Sb-c
2031 def __repr__(self):
2032 return f"<{__name__}.PciInfo object at {hex(id(self))}>" 1w
2034 @property
2035 def ptr(self):
2036 """Get the pointer address to the data as Python :class:`int`."""
2037 return <intptr_t>(self._ptr) 1w
2039 cdef intptr_t _get_ptr(self):
2040 return <intptr_t>(self._ptr) 1qewL
2042 def __int__(self):
2043 return <intptr_t>(self._ptr)
2045 def __eq__(self, other):
2046 cdef PciInfo other_
2047 if not isinstance(other, PciInfo):
2048 return False
2049 other_ = other
2050 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPciInfo_t)) == 0)
2052 def __setitem__(self, key, val):
2053 if key == 0 and isinstance(val, _numpy.ndarray):
2054 self._ptr = <nvmlPciInfo_t *>malloc(sizeof(nvmlPciInfo_t))
2055 if self._ptr == NULL:
2056 raise MemoryError("Error allocating PciInfo")
2057 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPciInfo_t))
2058 self._owner = None
2059 self._owned = True
2060 self._readonly = not val.flags.writeable
2061 else:
2062 setattr(self, key, val)
2064 @property
2065 def bus_id_legacy(self):
2066 """~_numpy.int8: (array of length 16)."""
2067 return cpython.PyUnicode_FromString(self._ptr[0].busIdLegacy)
2069 @bus_id_legacy.setter
2070 def bus_id_legacy(self, val):
2071 if self._readonly:
2072 raise ValueError("This PciInfo instance is read-only")
2073 cdef bytes buf = val.encode()
2074 if len(buf) >= 16:
2075 raise ValueError("String too long for field bus_id_legacy, max length is 15")
2076 cdef char *ptr = buf
2077 memcpy(<void *>(self._ptr[0].busIdLegacy), <void *>ptr, 16)
2079 @property
2080 def domain(self):
2081 """int: """
2082 return self._ptr[0].domain
2084 @domain.setter
2085 def domain(self, val):
2086 if self._readonly:
2087 raise ValueError("This PciInfo instance is read-only")
2088 self._ptr[0].domain = val
2090 @property
2091 def bus(self):
2092 """int: """
2093 return self._ptr[0].bus 1q
2095 @bus.setter
2096 def bus(self, val):
2097 if self._readonly:
2098 raise ValueError("This PciInfo instance is read-only")
2099 self._ptr[0].bus = val
2101 @property
2102 def device_(self):
2103 """int: """
2104 return self._ptr[0].device 1e
2106 @device_.setter
2107 def device_(self, val):
2108 if self._readonly:
2109 raise ValueError("This PciInfo instance is read-only")
2110 self._ptr[0].device = val
2112 @property
2113 def pci_device_id(self):
2114 """int: """
2115 return self._ptr[0].pciDeviceId 1e
2117 @pci_device_id.setter
2118 def pci_device_id(self, val):
2119 if self._readonly:
2120 raise ValueError("This PciInfo instance is read-only")
2121 self._ptr[0].pciDeviceId = val
2123 @property
2124 def pci_sub_system_id(self):
2125 """int: """
2126 return self._ptr[0].pciSubSystemId 1e
2128 @pci_sub_system_id.setter
2129 def pci_sub_system_id(self, val):
2130 if self._readonly:
2131 raise ValueError("This PciInfo instance is read-only")
2132 self._ptr[0].pciSubSystemId = val
2134 @property
2135 def bus_id(self):
2136 """~_numpy.int8: (array of length 32)."""
2137 return cpython.PyUnicode_FromString(self._ptr[0].busId) 2e Nb
2139 @bus_id.setter
2140 def bus_id(self, val):
2141 if self._readonly:
2142 raise ValueError("This PciInfo instance is read-only")
2143 cdef bytes buf = val.encode()
2144 if len(buf) >= 32:
2145 raise ValueError("String too long for field bus_id, max length is 31")
2146 cdef char *ptr = buf
2147 memcpy(<void *>(self._ptr[0].busId), <void *>ptr, 32)
2149 @staticmethod
2150 def from_data(data):
2151 """Create an PciInfo instance wrapping the given NumPy array.
2153 Args:
2154 data (_numpy.ndarray): a single-element array of dtype `pci_info_dtype` holding the data.
2155 """
2156 return __from_data(data, "pci_info_dtype", pci_info_dtype, PciInfo)
2158 @staticmethod
2159 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
2160 """Create an PciInfo instance wrapping the given pointer.
2162 Args:
2163 ptr (intptr_t): pointer address as Python :class:`int` to the data.
2164 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
2165 readonly (bool): whether the data is read-only (to the user). default is `False`.
2166 """
2167 if ptr == 0:
2168 raise ValueError("ptr must not be null (0)")
2169 cdef PciInfo obj = PciInfo.__new__(PciInfo)
2170 if owner is None:
2171 obj._ptr = <nvmlPciInfo_t *>malloc(sizeof(nvmlPciInfo_t))
2172 if obj._ptr == NULL:
2173 raise MemoryError("Error allocating PciInfo")
2174 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPciInfo_t))
2175 obj._owner = None
2176 obj._owned = True
2177 else:
2178 obj._ptr = <nvmlPciInfo_t *>ptr
2179 obj._owner = owner
2180 obj._owned = False
2181 obj._readonly = readonly
2182 return obj
2185cdef _get_utilization_dtype_offsets():
2186 cdef nvmlUtilization_t pod = nvmlUtilization_t()
2187 return _numpy.dtype({
2188 'names': ['gpu', 'memory'],
2189 'formats': [_numpy.uint32, _numpy.uint32],
2190 'offsets': [
2191 (<intptr_t>&(pod.gpu)) - (<intptr_t>&pod),
2192 (<intptr_t>&(pod.memory)) - (<intptr_t>&pod),
2193 ],
2194 'itemsize': sizeof(nvmlUtilization_t),
2195 })
2197utilization_dtype = _get_utilization_dtype_offsets()
2199cdef class Utilization:
2200 """Empty-initialize an instance of `nvmlUtilization_t`.
2203 .. seealso:: `nvmlUtilization_t`
2204 """
2205 cdef:
2206 nvmlUtilization_t *_ptr
2207 object _owner
2208 bint _owned
2209 bint _readonly
2211 def __init__(self):
2212 self._ptr = <nvmlUtilization_t *>calloc(1, sizeof(nvmlUtilization_t)) 1U
2213 if self._ptr == NULL: 1U
2214 raise MemoryError("Error allocating Utilization")
2215 self._owner = None 1U
2216 self._owned = True 1U
2217 self._readonly = False 1U
2219 def __dealloc__(self):
2220 cdef nvmlUtilization_t *ptr
2221 if self._owned and self._ptr != NULL: 1U
2222 ptr = self._ptr 1U
2223 self._ptr = NULL 1U
2224 free(ptr) 1U
2226 def __repr__(self):
2227 return f"<{__name__}.Utilization object at {hex(id(self))}>"
2229 @property
2230 def ptr(self):
2231 """Get the pointer address to the data as Python :class:`int`."""
2232 return <intptr_t>(self._ptr)
2234 cdef intptr_t _get_ptr(self):
2235 return <intptr_t>(self._ptr) 1U
2237 def __int__(self):
2238 return <intptr_t>(self._ptr)
2240 def __eq__(self, other):
2241 cdef Utilization other_
2242 if not isinstance(other, Utilization):
2243 return False
2244 other_ = other
2245 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlUtilization_t)) == 0)
2247 def __setitem__(self, key, val):
2248 if key == 0 and isinstance(val, _numpy.ndarray):
2249 self._ptr = <nvmlUtilization_t *>malloc(sizeof(nvmlUtilization_t))
2250 if self._ptr == NULL:
2251 raise MemoryError("Error allocating Utilization")
2252 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlUtilization_t))
2253 self._owner = None
2254 self._owned = True
2255 self._readonly = not val.flags.writeable
2256 else:
2257 setattr(self, key, val)
2259 @property
2260 def gpu(self):
2261 """int: """
2262 return self._ptr[0].gpu 1U
2264 @gpu.setter
2265 def gpu(self, val):
2266 if self._readonly:
2267 raise ValueError("This Utilization instance is read-only")
2268 self._ptr[0].gpu = val
2270 @property
2271 def memory(self):
2272 """int: """
2273 return self._ptr[0].memory 1U
2275 @memory.setter
2276 def memory(self, val):
2277 if self._readonly:
2278 raise ValueError("This Utilization instance is read-only")
2279 self._ptr[0].memory = val
2281 @staticmethod
2282 def from_data(data):
2283 """Create an Utilization instance wrapping the given NumPy array.
2285 Args:
2286 data (_numpy.ndarray): a single-element array of dtype `utilization_dtype` holding the data.
2287 """
2288 return __from_data(data, "utilization_dtype", utilization_dtype, Utilization)
2290 @staticmethod
2291 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
2292 """Create an Utilization instance wrapping the given pointer.
2294 Args:
2295 ptr (intptr_t): pointer address as Python :class:`int` to the data.
2296 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
2297 readonly (bool): whether the data is read-only (to the user). default is `False`.
2298 """
2299 if ptr == 0:
2300 raise ValueError("ptr must not be null (0)")
2301 cdef Utilization obj = Utilization.__new__(Utilization)
2302 if owner is None:
2303 obj._ptr = <nvmlUtilization_t *>malloc(sizeof(nvmlUtilization_t))
2304 if obj._ptr == NULL:
2305 raise MemoryError("Error allocating Utilization")
2306 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlUtilization_t))
2307 obj._owner = None
2308 obj._owned = True
2309 else:
2310 obj._ptr = <nvmlUtilization_t *>ptr
2311 obj._owner = owner
2312 obj._owned = False
2313 obj._readonly = readonly
2314 return obj
2317cdef _get_memory_dtype_offsets():
2318 cdef nvmlMemory_t pod = nvmlMemory_t()
2319 return _numpy.dtype({
2320 'names': ['total', 'free', 'used'],
2321 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64],
2322 'offsets': [
2323 (<intptr_t>&(pod.total)) - (<intptr_t>&pod),
2324 (<intptr_t>&(pod.free)) - (<intptr_t>&pod),
2325 (<intptr_t>&(pod.used)) - (<intptr_t>&pod),
2326 ],
2327 'itemsize': sizeof(nvmlMemory_t),
2328 })
2330memory_dtype = _get_memory_dtype_offsets()
2332cdef class Memory:
2333 """Empty-initialize an instance of `nvmlMemory_t`.
2336 .. seealso:: `nvmlMemory_t`
2337 """
2338 cdef:
2339 nvmlMemory_t *_ptr
2340 object _owner
2341 bint _owned
2342 bint _readonly
2344 def __init__(self):
2345 self._ptr = <nvmlMemory_t *>calloc(1, sizeof(nvmlMemory_t))
2346 if self._ptr == NULL:
2347 raise MemoryError("Error allocating Memory")
2348 self._owner = None
2349 self._owned = True
2350 self._readonly = False
2352 def __dealloc__(self):
2353 cdef nvmlMemory_t *ptr
2354 if self._owned and self._ptr != NULL:
2355 ptr = self._ptr
2356 self._ptr = NULL
2357 free(ptr)
2359 def __repr__(self):
2360 return f"<{__name__}.Memory object at {hex(id(self))}>"
2362 @property
2363 def ptr(self):
2364 """Get the pointer address to the data as Python :class:`int`."""
2365 return <intptr_t>(self._ptr)
2367 cdef intptr_t _get_ptr(self):
2368 return <intptr_t>(self._ptr)
2370 def __int__(self):
2371 return <intptr_t>(self._ptr)
2373 def __eq__(self, other):
2374 cdef Memory other_
2375 if not isinstance(other, Memory):
2376 return False
2377 other_ = other
2378 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlMemory_t)) == 0)
2380 def __setitem__(self, key, val):
2381 if key == 0 and isinstance(val, _numpy.ndarray):
2382 self._ptr = <nvmlMemory_t *>malloc(sizeof(nvmlMemory_t))
2383 if self._ptr == NULL:
2384 raise MemoryError("Error allocating Memory")
2385 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlMemory_t))
2386 self._owner = None
2387 self._owned = True
2388 self._readonly = not val.flags.writeable
2389 else:
2390 setattr(self, key, val)
2392 @property
2393 def total(self):
2394 """int: """
2395 return self._ptr[0].total
2397 @total.setter
2398 def total(self, val):
2399 if self._readonly:
2400 raise ValueError("This Memory instance is read-only")
2401 self._ptr[0].total = val
2403 @property
2404 def free(self):
2405 """int: """
2406 return self._ptr[0].free
2408 @free.setter
2409 def free(self, val):
2410 if self._readonly:
2411 raise ValueError("This Memory instance is read-only")
2412 self._ptr[0].free = val
2414 @property
2415 def used(self):
2416 """int: """
2417 return self._ptr[0].used
2419 @used.setter
2420 def used(self, val):
2421 if self._readonly:
2422 raise ValueError("This Memory instance is read-only")
2423 self._ptr[0].used = val
2425 @staticmethod
2426 def from_data(data):
2427 """Create an Memory instance wrapping the given NumPy array.
2429 Args:
2430 data (_numpy.ndarray): a single-element array of dtype `memory_dtype` holding the data.
2431 """
2432 return __from_data(data, "memory_dtype", memory_dtype, Memory)
2434 @staticmethod
2435 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
2436 """Create an Memory instance wrapping the given pointer.
2438 Args:
2439 ptr (intptr_t): pointer address as Python :class:`int` to the data.
2440 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
2441 readonly (bool): whether the data is read-only (to the user). default is `False`.
2442 """
2443 if ptr == 0:
2444 raise ValueError("ptr must not be null (0)")
2445 cdef Memory obj = Memory.__new__(Memory)
2446 if owner is None:
2447 obj._ptr = <nvmlMemory_t *>malloc(sizeof(nvmlMemory_t))
2448 if obj._ptr == NULL:
2449 raise MemoryError("Error allocating Memory")
2450 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlMemory_t))
2451 obj._owner = None
2452 obj._owned = True
2453 else:
2454 obj._ptr = <nvmlMemory_t *>ptr
2455 obj._owner = owner
2456 obj._owned = False
2457 obj._readonly = readonly
2458 return obj
2461cdef _get_memory_v2_dtype_offsets():
2462 cdef nvmlMemory_v2_t pod = nvmlMemory_v2_t()
2463 return _numpy.dtype({
2464 'names': ['version', 'total', 'reserved', 'free', 'used'],
2465 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64],
2466 'offsets': [
2467 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
2468 (<intptr_t>&(pod.total)) - (<intptr_t>&pod),
2469 (<intptr_t>&(pod.reserved)) - (<intptr_t>&pod),
2470 (<intptr_t>&(pod.free)) - (<intptr_t>&pod),
2471 (<intptr_t>&(pod.used)) - (<intptr_t>&pod),
2472 ],
2473 'itemsize': sizeof(nvmlMemory_v2_t),
2474 })
2476memory_v2_dtype = _get_memory_v2_dtype_offsets()
2478cdef class Memory_v2:
2479 """Empty-initialize an instance of `nvmlMemory_v2_t`.
2482 .. seealso:: `nvmlMemory_v2_t`
2483 """
2484 cdef:
2485 nvmlMemory_v2_t *_ptr
2486 object _owner
2487 bint _owned
2488 bint _readonly
2490 def __init__(self):
2491 self._ptr = <nvmlMemory_v2_t *>calloc(1, sizeof(nvmlMemory_v2_t)) 1Fr
2492 if self._ptr == NULL: 1Fr
2493 raise MemoryError("Error allocating Memory_v2")
2494 self._owner = None 1Fr
2495 self._owned = True 1Fr
2496 self._readonly = False 1Fr
2498 def __dealloc__(self):
2499 cdef nvmlMemory_v2_t *ptr
2500 if self._owned and self._ptr != NULL: 1Fr
2501 ptr = self._ptr 1Fr
2502 self._ptr = NULL 1Fr
2503 free(ptr) 1Fr
2505 def __repr__(self):
2506 return f"<{__name__}.Memory_v2 object at {hex(id(self))}>"
2508 @property
2509 def ptr(self):
2510 """Get the pointer address to the data as Python :class:`int`."""
2511 return <intptr_t>(self._ptr)
2513 cdef intptr_t _get_ptr(self):
2514 return <intptr_t>(self._ptr) 1Fr
2516 def __int__(self):
2517 return <intptr_t>(self._ptr)
2519 def __eq__(self, other):
2520 cdef Memory_v2 other_
2521 if not isinstance(other, Memory_v2):
2522 return False
2523 other_ = other
2524 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlMemory_v2_t)) == 0)
2526 def __setitem__(self, key, val):
2527 if key == 0 and isinstance(val, _numpy.ndarray):
2528 self._ptr = <nvmlMemory_v2_t *>malloc(sizeof(nvmlMemory_v2_t))
2529 if self._ptr == NULL:
2530 raise MemoryError("Error allocating Memory_v2")
2531 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlMemory_v2_t))
2532 self._owner = None
2533 self._owned = True
2534 self._readonly = not val.flags.writeable
2535 else:
2536 setattr(self, key, val)
2538 @property
2539 def version(self):
2540 """int: """
2541 return self._ptr[0].version
2543 @version.setter
2544 def version(self, val):
2545 if self._readonly:
2546 raise ValueError("This Memory_v2 instance is read-only")
2547 self._ptr[0].version = val
2549 @property
2550 def total(self):
2551 """int: """
2552 return self._ptr[0].total 1Fr
2554 @total.setter
2555 def total(self, val):
2556 if self._readonly:
2557 raise ValueError("This Memory_v2 instance is read-only")
2558 self._ptr[0].total = val
2560 @property
2561 def reserved(self):
2562 """int: """
2563 return self._ptr[0].reserved 1r
2565 @reserved.setter
2566 def reserved(self, val):
2567 if self._readonly:
2568 raise ValueError("This Memory_v2 instance is read-only")
2569 self._ptr[0].reserved = val
2571 @property
2572 def free(self):
2573 """int: """
2574 return self._ptr[0].free 1Fr
2576 @free.setter
2577 def free(self, val):
2578 if self._readonly:
2579 raise ValueError("This Memory_v2 instance is read-only")
2580 self._ptr[0].free = val
2582 @property
2583 def used(self):
2584 """int: """
2585 return self._ptr[0].used 1Fr
2587 @used.setter
2588 def used(self, val):
2589 if self._readonly:
2590 raise ValueError("This Memory_v2 instance is read-only")
2591 self._ptr[0].used = val
2593 @staticmethod
2594 def from_data(data):
2595 """Create an Memory_v2 instance wrapping the given NumPy array.
2597 Args:
2598 data (_numpy.ndarray): a single-element array of dtype `memory_v2_dtype` holding the data.
2599 """
2600 return __from_data(data, "memory_v2_dtype", memory_v2_dtype, Memory_v2)
2602 @staticmethod
2603 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
2604 """Create an Memory_v2 instance wrapping the given pointer.
2606 Args:
2607 ptr (intptr_t): pointer address as Python :class:`int` to the data.
2608 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
2609 readonly (bool): whether the data is read-only (to the user). default is `False`.
2610 """
2611 if ptr == 0:
2612 raise ValueError("ptr must not be null (0)")
2613 cdef Memory_v2 obj = Memory_v2.__new__(Memory_v2)
2614 if owner is None:
2615 obj._ptr = <nvmlMemory_v2_t *>malloc(sizeof(nvmlMemory_v2_t))
2616 if obj._ptr == NULL:
2617 raise MemoryError("Error allocating Memory_v2")
2618 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlMemory_v2_t))
2619 obj._owner = None
2620 obj._owned = True
2621 else:
2622 obj._ptr = <nvmlMemory_v2_t *>ptr
2623 obj._owner = owner
2624 obj._owned = False
2625 obj._readonly = readonly
2626 return obj
2629cdef _get_ba_r1memory_dtype_offsets():
2630 cdef nvmlBAR1Memory_t pod = nvmlBAR1Memory_t()
2631 return _numpy.dtype({
2632 'names': ['bar1_total', 'bar1_free', 'bar1_used'],
2633 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64],
2634 'offsets': [
2635 (<intptr_t>&(pod.bar1Total)) - (<intptr_t>&pod),
2636 (<intptr_t>&(pod.bar1Free)) - (<intptr_t>&pod),
2637 (<intptr_t>&(pod.bar1Used)) - (<intptr_t>&pod),
2638 ],
2639 'itemsize': sizeof(nvmlBAR1Memory_t),
2640 })
2642ba_r1memory_dtype = _get_ba_r1memory_dtype_offsets()
2644cdef class BAR1Memory:
2645 """Empty-initialize an instance of `nvmlBAR1Memory_t`.
2648 .. seealso:: `nvmlBAR1Memory_t`
2649 """
2650 cdef:
2651 nvmlBAR1Memory_t *_ptr
2652 object _owner
2653 bint _owned
2654 bint _readonly
2656 def __init__(self):
2657 self._ptr = <nvmlBAR1Memory_t *>calloc(1, sizeof(nvmlBAR1Memory_t)) 1y
2658 if self._ptr == NULL: 1y
2659 raise MemoryError("Error allocating BAR1Memory")
2660 self._owner = None 1y
2661 self._owned = True 1y
2662 self._readonly = False 1y
2664 def __dealloc__(self):
2665 cdef nvmlBAR1Memory_t *ptr
2666 if self._owned and self._ptr != NULL: 1y
2667 ptr = self._ptr 1y
2668 self._ptr = NULL 1y
2669 free(ptr) 1y
2671 def __repr__(self):
2672 return f"<{__name__}.BAR1Memory object at {hex(id(self))}>"
2674 @property
2675 def ptr(self):
2676 """Get the pointer address to the data as Python :class:`int`."""
2677 return <intptr_t>(self._ptr)
2679 cdef intptr_t _get_ptr(self):
2680 return <intptr_t>(self._ptr) 1y
2682 def __int__(self):
2683 return <intptr_t>(self._ptr)
2685 def __eq__(self, other):
2686 cdef BAR1Memory other_
2687 if not isinstance(other, BAR1Memory):
2688 return False
2689 other_ = other
2690 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlBAR1Memory_t)) == 0)
2692 def __setitem__(self, key, val):
2693 if key == 0 and isinstance(val, _numpy.ndarray):
2694 self._ptr = <nvmlBAR1Memory_t *>malloc(sizeof(nvmlBAR1Memory_t))
2695 if self._ptr == NULL:
2696 raise MemoryError("Error allocating BAR1Memory")
2697 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlBAR1Memory_t))
2698 self._owner = None
2699 self._owned = True
2700 self._readonly = not val.flags.writeable
2701 else:
2702 setattr(self, key, val)
2704 @property
2705 def bar1_total(self):
2706 """int: """
2707 return self._ptr[0].bar1Total 1y
2709 @bar1_total.setter
2710 def bar1_total(self, val):
2711 if self._readonly:
2712 raise ValueError("This BAR1Memory instance is read-only")
2713 self._ptr[0].bar1Total = val
2715 @property
2716 def bar1_free(self):
2717 """int: """
2718 return self._ptr[0].bar1Free 1y
2720 @bar1_free.setter
2721 def bar1_free(self, val):
2722 if self._readonly:
2723 raise ValueError("This BAR1Memory instance is read-only")
2724 self._ptr[0].bar1Free = val
2726 @property
2727 def bar1_used(self):
2728 """int: """
2729 return self._ptr[0].bar1Used 1y
2731 @bar1_used.setter
2732 def bar1_used(self, val):
2733 if self._readonly:
2734 raise ValueError("This BAR1Memory instance is read-only")
2735 self._ptr[0].bar1Used = val
2737 @staticmethod
2738 def from_data(data):
2739 """Create an BAR1Memory instance wrapping the given NumPy array.
2741 Args:
2742 data (_numpy.ndarray): a single-element array of dtype `ba_r1memory_dtype` holding the data.
2743 """
2744 return __from_data(data, "ba_r1memory_dtype", ba_r1memory_dtype, BAR1Memory)
2746 @staticmethod
2747 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
2748 """Create an BAR1Memory instance wrapping the given pointer.
2750 Args:
2751 ptr (intptr_t): pointer address as Python :class:`int` to the data.
2752 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
2753 readonly (bool): whether the data is read-only (to the user). default is `False`.
2754 """
2755 if ptr == 0:
2756 raise ValueError("ptr must not be null (0)")
2757 cdef BAR1Memory obj = BAR1Memory.__new__(BAR1Memory)
2758 if owner is None:
2759 obj._ptr = <nvmlBAR1Memory_t *>malloc(sizeof(nvmlBAR1Memory_t))
2760 if obj._ptr == NULL:
2761 raise MemoryError("Error allocating BAR1Memory")
2762 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlBAR1Memory_t))
2763 obj._owner = None
2764 obj._owned = True
2765 else:
2766 obj._ptr = <nvmlBAR1Memory_t *>ptr
2767 obj._owner = owner
2768 obj._owned = False
2769 obj._readonly = readonly
2770 return obj
2773cdef _get_process_info_dtype_offsets():
2774 cdef nvmlProcessInfo_t pod = nvmlProcessInfo_t()
2775 return _numpy.dtype({
2776 'names': ['pid', 'used_gpu_memory', 'gpu_instance_id', 'compute_instance_id'],
2777 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32],
2778 'offsets': [
2779 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
2780 (<intptr_t>&(pod.usedGpuMemory)) - (<intptr_t>&pod),
2781 (<intptr_t>&(pod.gpuInstanceId)) - (<intptr_t>&pod),
2782 (<intptr_t>&(pod.computeInstanceId)) - (<intptr_t>&pod),
2783 ],
2784 'itemsize': sizeof(nvmlProcessInfo_t),
2785 })
2787process_info_dtype = _get_process_info_dtype_offsets()
2789cdef class ProcessInfo:
2790 """Empty-initialize an array of `nvmlProcessInfo_t`.
2792 The resulting object is of length `size` and of dtype `process_info_dtype`.
2793 If default-constructed, the instance represents a single struct.
2795 Args:
2796 size (int): number of structs, default=1.
2799 .. seealso:: `nvmlProcessInfo_t`
2800 """
2801 cdef:
2802 readonly object _data
2806 def __init__(self, size=1):
2807 arr = _numpy.empty(size, dtype=process_info_dtype)
2808 self._data = arr.view(_numpy.recarray)
2809 assert self._data.itemsize == sizeof(nvmlProcessInfo_t), \
2810 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessInfo_t) }"
2812 def __repr__(self):
2813 if self._data.size > 1:
2814 return f"<{__name__}.ProcessInfo_Array_{self._data.size} object at {hex(id(self))}>"
2815 else:
2816 return f"<{__name__}.ProcessInfo object at {hex(id(self))}>"
2818 @property
2819 def ptr(self):
2820 """Get the pointer address to the data as Python :class:`int`."""
2821 return self._data.ctypes.data
2823 cdef intptr_t _get_ptr(self):
2824 return self._data.ctypes.data
2826 def __int__(self):
2827 if self._data.size > 1:
2828 raise TypeError("int() argument must be a bytes-like object of size 1. "
2829 "To get the pointer address of an array, use .ptr")
2830 return self._data.ctypes.data
2832 def __len__(self):
2833 return self._data.size
2835 def __eq__(self, other):
2836 cdef object self_data = self._data
2837 if (not isinstance(other, ProcessInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
2838 return False
2839 return bool((self_data == other._data).all())
2841 @property
2842 def pid(self):
2843 """Union[~_numpy.uint32, int]: """
2844 if self._data.size == 1:
2845 return int(self._data.pid[0])
2846 return self._data.pid
2848 @pid.setter
2849 def pid(self, val):
2850 self._data.pid = val
2852 @property
2853 def used_gpu_memory(self):
2854 """Union[~_numpy.uint64, int]: """
2855 if self._data.size == 1:
2856 return int(self._data.used_gpu_memory[0])
2857 return self._data.used_gpu_memory
2859 @used_gpu_memory.setter
2860 def used_gpu_memory(self, val):
2861 self._data.used_gpu_memory = val
2863 @property
2864 def gpu_instance_id(self):
2865 """Union[~_numpy.uint32, int]: """
2866 if self._data.size == 1:
2867 return int(self._data.gpu_instance_id[0])
2868 return self._data.gpu_instance_id
2870 @gpu_instance_id.setter
2871 def gpu_instance_id(self, val):
2872 self._data.gpu_instance_id = val
2874 @property
2875 def compute_instance_id(self):
2876 """Union[~_numpy.uint32, int]: """
2877 if self._data.size == 1:
2878 return int(self._data.compute_instance_id[0])
2879 return self._data.compute_instance_id
2881 @compute_instance_id.setter
2882 def compute_instance_id(self, val):
2883 self._data.compute_instance_id = val
2885 def __getitem__(self, key):
2886 cdef ssize_t key_
2887 cdef ssize_t size
2888 if isinstance(key, int):
2889 key_ = key
2890 size = self._data.size
2891 if key_ >= size or key_ <= -(size+1):
2892 raise IndexError("index is out of bounds")
2893 if key_ < 0:
2894 key_ += size
2895 return ProcessInfo.from_data(self._data[key_:key_+1])
2896 out = self._data[key]
2897 if isinstance(out, _numpy.recarray) and out.dtype == process_info_dtype:
2898 return ProcessInfo.from_data(out)
2899 return out
2901 def __setitem__(self, key, val):
2902 self._data[key] = val
2904 @staticmethod
2905 def from_data(data):
2906 """Create an ProcessInfo instance wrapping the given NumPy array.
2908 Args:
2909 data (_numpy.ndarray): a 1D array of dtype `process_info_dtype` holding the data.
2910 """
2911 cdef ProcessInfo obj = ProcessInfo.__new__(ProcessInfo)
2912 if not isinstance(data, _numpy.ndarray):
2913 raise TypeError("data argument must be a NumPy ndarray")
2914 if data.ndim != 1:
2915 raise ValueError("data array must be 1D")
2916 if data.dtype != process_info_dtype:
2917 raise ValueError("data array must be of dtype process_info_dtype")
2918 obj._data = data.view(_numpy.recarray)
2920 return obj
2922 @staticmethod
2923 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
2924 """Create an ProcessInfo instance wrapping the given pointer.
2926 Args:
2927 ptr (intptr_t): pointer address as Python :class:`int` to the data.
2928 size (int): number of structs, default=1.
2929 readonly (bool): whether the data is read-only (to the user). default is `False`.
2930 """
2931 if ptr == 0:
2932 raise ValueError("ptr must not be null (0)")
2933 cdef ProcessInfo obj = ProcessInfo.__new__(ProcessInfo)
2934 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
2935 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
2936 <char*>ptr, sizeof(nvmlProcessInfo_t) * size, flag)
2937 data = _numpy.ndarray(size, buffer=buf, dtype=process_info_dtype)
2938 obj._data = data.view(_numpy.recarray)
2940 return obj
2943cdef _get_process_detail_v1_dtype_offsets():
2944 cdef nvmlProcessDetail_v1_t pod = nvmlProcessDetail_v1_t()
2945 return _numpy.dtype({
2946 'names': ['pid', 'used_gpu_memory', 'gpu_instance_id', 'compute_instance_id', 'used_gpu_cc_protected_memory'],
2947 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint64],
2948 'offsets': [
2949 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
2950 (<intptr_t>&(pod.usedGpuMemory)) - (<intptr_t>&pod),
2951 (<intptr_t>&(pod.gpuInstanceId)) - (<intptr_t>&pod),
2952 (<intptr_t>&(pod.computeInstanceId)) - (<intptr_t>&pod),
2953 (<intptr_t>&(pod.usedGpuCcProtectedMemory)) - (<intptr_t>&pod),
2954 ],
2955 'itemsize': sizeof(nvmlProcessDetail_v1_t),
2956 })
2958process_detail_v1_dtype = _get_process_detail_v1_dtype_offsets()
2960cdef class ProcessDetail_v1:
2961 """Empty-initialize an array of `nvmlProcessDetail_v1_t`.
2963 The resulting object is of length `size` and of dtype `process_detail_v1_dtype`.
2964 If default-constructed, the instance represents a single struct.
2966 Args:
2967 size (int): number of structs, default=1.
2970 .. seealso:: `nvmlProcessDetail_v1_t`
2971 """
2972 cdef:
2973 readonly object _data
2977 def __init__(self, size=1):
2978 arr = _numpy.empty(size, dtype=process_detail_v1_dtype)
2979 self._data = arr.view(_numpy.recarray)
2980 assert self._data.itemsize == sizeof(nvmlProcessDetail_v1_t), \
2981 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessDetail_v1_t) }"
2983 def __repr__(self):
2984 if self._data.size > 1:
2985 return f"<{__name__}.ProcessDetail_v1_Array_{self._data.size} object at {hex(id(self))}>"
2986 else:
2987 return f"<{__name__}.ProcessDetail_v1 object at {hex(id(self))}>"
2989 @property
2990 def ptr(self):
2991 """Get the pointer address to the data as Python :class:`int`."""
2992 return self._data.ctypes.data
2994 cdef intptr_t _get_ptr(self):
2995 return self._data.ctypes.data
2997 def __int__(self):
2998 if self._data.size > 1:
2999 raise TypeError("int() argument must be a bytes-like object of size 1. "
3000 "To get the pointer address of an array, use .ptr")
3001 return self._data.ctypes.data
3003 def __len__(self):
3004 return self._data.size
3006 def __eq__(self, other):
3007 cdef object self_data = self._data
3008 if (not isinstance(other, ProcessDetail_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
3009 return False
3010 return bool((self_data == other._data).all())
3012 @property
3013 def pid(self):
3014 """Union[~_numpy.uint32, int]: Process ID."""
3015 if self._data.size == 1:
3016 return int(self._data.pid[0])
3017 return self._data.pid
3019 @pid.setter
3020 def pid(self, val):
3021 self._data.pid = val
3023 @property
3024 def used_gpu_memory(self):
3025 """Union[~_numpy.uint64, int]: Amount of used GPU memory in bytes. Under WDDM, NVML_VALUE_NOT_AVAILABLE is always reported because Windows KMD manages all the memory and not the NVIDIA driver"""
3026 if self._data.size == 1:
3027 return int(self._data.used_gpu_memory[0])
3028 return self._data.used_gpu_memory
3030 @used_gpu_memory.setter
3031 def used_gpu_memory(self, val):
3032 self._data.used_gpu_memory = val
3034 @property
3035 def gpu_instance_id(self):
3036 """Union[~_numpy.uint32, int]: If MIG is enabled, stores a valid GPU instance ID. gpuInstanceId is."""
3037 if self._data.size == 1:
3038 return int(self._data.gpu_instance_id[0])
3039 return self._data.gpu_instance_id
3041 @gpu_instance_id.setter
3042 def gpu_instance_id(self, val):
3043 self._data.gpu_instance_id = val
3045 @property
3046 def compute_instance_id(self):
3047 """Union[~_numpy.uint32, int]: If MIG is enabled, stores a valid compute instance ID. computeInstanceId."""
3048 if self._data.size == 1:
3049 return int(self._data.compute_instance_id[0])
3050 return self._data.compute_instance_id
3052 @compute_instance_id.setter
3053 def compute_instance_id(self, val):
3054 self._data.compute_instance_id = val
3056 @property
3057 def used_gpu_cc_protected_memory(self):
3058 """Union[~_numpy.uint64, int]: Amount of used GPU conf compute protected memory in bytes."""
3059 if self._data.size == 1:
3060 return int(self._data.used_gpu_cc_protected_memory[0])
3061 return self._data.used_gpu_cc_protected_memory
3063 @used_gpu_cc_protected_memory.setter
3064 def used_gpu_cc_protected_memory(self, val):
3065 self._data.used_gpu_cc_protected_memory = val
3067 def __getitem__(self, key):
3068 cdef ssize_t key_
3069 cdef ssize_t size
3070 if isinstance(key, int):
3071 key_ = key
3072 size = self._data.size
3073 if key_ >= size or key_ <= -(size+1):
3074 raise IndexError("index is out of bounds")
3075 if key_ < 0:
3076 key_ += size
3077 return ProcessDetail_v1.from_data(self._data[key_:key_+1])
3078 out = self._data[key]
3079 if isinstance(out, _numpy.recarray) and out.dtype == process_detail_v1_dtype:
3080 return ProcessDetail_v1.from_data(out)
3081 return out
3083 def __setitem__(self, key, val):
3084 self._data[key] = val
3086 @staticmethod
3087 def from_data(data):
3088 """Create an ProcessDetail_v1 instance wrapping the given NumPy array.
3090 Args:
3091 data (_numpy.ndarray): a 1D array of dtype `process_detail_v1_dtype` holding the data.
3092 """
3093 cdef ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_v1)
3094 if not isinstance(data, _numpy.ndarray):
3095 raise TypeError("data argument must be a NumPy ndarray")
3096 if data.ndim != 1:
3097 raise ValueError("data array must be 1D")
3098 if data.dtype != process_detail_v1_dtype:
3099 raise ValueError("data array must be of dtype process_detail_v1_dtype")
3100 obj._data = data.view(_numpy.recarray)
3102 return obj
3104 @staticmethod
3105 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
3106 """Create an ProcessDetail_v1 instance wrapping the given pointer.
3108 Args:
3109 ptr (intptr_t): pointer address as Python :class:`int` to the data.
3110 size (int): number of structs, default=1.
3111 readonly (bool): whether the data is read-only (to the user). default is `False`.
3112 """
3113 if ptr == 0:
3114 raise ValueError("ptr must not be null (0)")
3115 cdef ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_v1)
3116 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
3117 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
3118 <char*>ptr, sizeof(nvmlProcessDetail_v1_t) * size, flag)
3119 data = _numpy.ndarray(size, buffer=buf, dtype=process_detail_v1_dtype)
3120 obj._data = data.view(_numpy.recarray)
3122 return obj
3125cdef _get_device_attributes_dtype_offsets():
3126 cdef nvmlDeviceAttributes_t pod = nvmlDeviceAttributes_t()
3127 return _numpy.dtype({
3128 'names': ['multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'gpu_instance_slice_count', 'compute_instance_slice_count', 'memory_size_mb'],
3129 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64],
3130 'offsets': [
3131 (<intptr_t>&(pod.multiprocessorCount)) - (<intptr_t>&pod),
3132 (<intptr_t>&(pod.sharedCopyEngineCount)) - (<intptr_t>&pod),
3133 (<intptr_t>&(pod.sharedDecoderCount)) - (<intptr_t>&pod),
3134 (<intptr_t>&(pod.sharedEncoderCount)) - (<intptr_t>&pod),
3135 (<intptr_t>&(pod.sharedJpegCount)) - (<intptr_t>&pod),
3136 (<intptr_t>&(pod.sharedOfaCount)) - (<intptr_t>&pod),
3137 (<intptr_t>&(pod.gpuInstanceSliceCount)) - (<intptr_t>&pod),
3138 (<intptr_t>&(pod.computeInstanceSliceCount)) - (<intptr_t>&pod),
3139 (<intptr_t>&(pod.memorySizeMB)) - (<intptr_t>&pod),
3140 ],
3141 'itemsize': sizeof(nvmlDeviceAttributes_t),
3142 })
3144device_attributes_dtype = _get_device_attributes_dtype_offsets()
3146cdef class DeviceAttributes:
3147 """Empty-initialize an instance of `nvmlDeviceAttributes_t`.
3150 .. seealso:: `nvmlDeviceAttributes_t`
3151 """
3152 cdef:
3153 nvmlDeviceAttributes_t *_ptr
3154 object _owner
3155 bint _owned
3156 bint _readonly
3158 def __init__(self):
3159 self._ptr = <nvmlDeviceAttributes_t *>calloc(1, sizeof(nvmlDeviceAttributes_t)) 1k
3160 if self._ptr == NULL: 1k
3161 raise MemoryError("Error allocating DeviceAttributes")
3162 self._owner = None 1k
3163 self._owned = True 1k
3164 self._readonly = False 1k
3166 def __dealloc__(self):
3167 cdef nvmlDeviceAttributes_t *ptr
3168 if self._owned and self._ptr != NULL: 1k
3169 ptr = self._ptr 1k
3170 self._ptr = NULL 1k
3171 free(ptr) 1k
3173 def __repr__(self):
3174 return f"<{__name__}.DeviceAttributes object at {hex(id(self))}>"
3176 @property
3177 def ptr(self):
3178 """Get the pointer address to the data as Python :class:`int`."""
3179 return <intptr_t>(self._ptr)
3181 cdef intptr_t _get_ptr(self):
3182 return <intptr_t>(self._ptr) 1k
3184 def __int__(self):
3185 return <intptr_t>(self._ptr)
3187 def __eq__(self, other):
3188 cdef DeviceAttributes other_
3189 if not isinstance(other, DeviceAttributes):
3190 return False
3191 other_ = other
3192 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlDeviceAttributes_t)) == 0)
3194 def __setitem__(self, key, val):
3195 if key == 0 and isinstance(val, _numpy.ndarray):
3196 self._ptr = <nvmlDeviceAttributes_t *>malloc(sizeof(nvmlDeviceAttributes_t))
3197 if self._ptr == NULL:
3198 raise MemoryError("Error allocating DeviceAttributes")
3199 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlDeviceAttributes_t))
3200 self._owner = None
3201 self._owned = True
3202 self._readonly = not val.flags.writeable
3203 else:
3204 setattr(self, key, val)
3206 @property
3207 def multiprocessor_count(self):
3208 """int: """
3209 return self._ptr[0].multiprocessorCount
3211 @multiprocessor_count.setter
3212 def multiprocessor_count(self, val):
3213 if self._readonly:
3214 raise ValueError("This DeviceAttributes instance is read-only")
3215 self._ptr[0].multiprocessorCount = val
3217 @property
3218 def shared_copy_engine_count(self):
3219 """int: """
3220 return self._ptr[0].sharedCopyEngineCount
3222 @shared_copy_engine_count.setter
3223 def shared_copy_engine_count(self, val):
3224 if self._readonly:
3225 raise ValueError("This DeviceAttributes instance is read-only")
3226 self._ptr[0].sharedCopyEngineCount = val
3228 @property
3229 def shared_decoder_count(self):
3230 """int: """
3231 return self._ptr[0].sharedDecoderCount
3233 @shared_decoder_count.setter
3234 def shared_decoder_count(self, val):
3235 if self._readonly:
3236 raise ValueError("This DeviceAttributes instance is read-only")
3237 self._ptr[0].sharedDecoderCount = val
3239 @property
3240 def shared_encoder_count(self):
3241 """int: """
3242 return self._ptr[0].sharedEncoderCount
3244 @shared_encoder_count.setter
3245 def shared_encoder_count(self, val):
3246 if self._readonly:
3247 raise ValueError("This DeviceAttributes instance is read-only")
3248 self._ptr[0].sharedEncoderCount = val
3250 @property
3251 def shared_jpeg_count(self):
3252 """int: """
3253 return self._ptr[0].sharedJpegCount
3255 @shared_jpeg_count.setter
3256 def shared_jpeg_count(self, val):
3257 if self._readonly:
3258 raise ValueError("This DeviceAttributes instance is read-only")
3259 self._ptr[0].sharedJpegCount = val
3261 @property
3262 def shared_ofa_count(self):
3263 """int: """
3264 return self._ptr[0].sharedOfaCount
3266 @shared_ofa_count.setter
3267 def shared_ofa_count(self, val):
3268 if self._readonly:
3269 raise ValueError("This DeviceAttributes instance is read-only")
3270 self._ptr[0].sharedOfaCount = val
3272 @property
3273 def gpu_instance_slice_count(self):
3274 """int: """
3275 return self._ptr[0].gpuInstanceSliceCount
3277 @gpu_instance_slice_count.setter
3278 def gpu_instance_slice_count(self, val):
3279 if self._readonly:
3280 raise ValueError("This DeviceAttributes instance is read-only")
3281 self._ptr[0].gpuInstanceSliceCount = val
3283 @property
3284 def compute_instance_slice_count(self):
3285 """int: """
3286 return self._ptr[0].computeInstanceSliceCount
3288 @compute_instance_slice_count.setter
3289 def compute_instance_slice_count(self, val):
3290 if self._readonly:
3291 raise ValueError("This DeviceAttributes instance is read-only")
3292 self._ptr[0].computeInstanceSliceCount = val
3294 @property
3295 def memory_size_mb(self):
3296 """int: """
3297 return self._ptr[0].memorySizeMB
3299 @memory_size_mb.setter
3300 def memory_size_mb(self, val):
3301 if self._readonly:
3302 raise ValueError("This DeviceAttributes instance is read-only")
3303 self._ptr[0].memorySizeMB = val
3305 @staticmethod
3306 def from_data(data):
3307 """Create an DeviceAttributes instance wrapping the given NumPy array.
3309 Args:
3310 data (_numpy.ndarray): a single-element array of dtype `device_attributes_dtype` holding the data.
3311 """
3312 return __from_data(data, "device_attributes_dtype", device_attributes_dtype, DeviceAttributes)
3314 @staticmethod
3315 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
3316 """Create an DeviceAttributes instance wrapping the given pointer.
3318 Args:
3319 ptr (intptr_t): pointer address as Python :class:`int` to the data.
3320 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
3321 readonly (bool): whether the data is read-only (to the user). default is `False`.
3322 """
3323 if ptr == 0:
3324 raise ValueError("ptr must not be null (0)")
3325 cdef DeviceAttributes obj = DeviceAttributes.__new__(DeviceAttributes)
3326 if owner is None:
3327 obj._ptr = <nvmlDeviceAttributes_t *>malloc(sizeof(nvmlDeviceAttributes_t))
3328 if obj._ptr == NULL:
3329 raise MemoryError("Error allocating DeviceAttributes")
3330 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlDeviceAttributes_t))
3331 obj._owner = None
3332 obj._owned = True
3333 else:
3334 obj._ptr = <nvmlDeviceAttributes_t *>ptr
3335 obj._owner = owner
3336 obj._owned = False
3337 obj._readonly = readonly
3338 return obj
3341cdef _get_c2c_mode_info_v1_dtype_offsets():
3342 cdef nvmlC2cModeInfo_v1_t pod = nvmlC2cModeInfo_v1_t()
3343 return _numpy.dtype({
3344 'names': ['is_c2c_enabled'],
3345 'formats': [_numpy.uint32],
3346 'offsets': [
3347 (<intptr_t>&(pod.isC2cEnabled)) - (<intptr_t>&pod),
3348 ],
3349 'itemsize': sizeof(nvmlC2cModeInfo_v1_t),
3350 })
3352c2c_mode_info_v1_dtype = _get_c2c_mode_info_v1_dtype_offsets()
3354cdef class C2cModeInfo_v1:
3355 """Empty-initialize an instance of `nvmlC2cModeInfo_v1_t`.
3358 .. seealso:: `nvmlC2cModeInfo_v1_t`
3359 """
3360 cdef:
3361 nvmlC2cModeInfo_v1_t *_ptr
3362 object _owner
3363 bint _owned
3364 bint _readonly
3366 def __init__(self):
3367 self._ptr = <nvmlC2cModeInfo_v1_t *>calloc(1, sizeof(nvmlC2cModeInfo_v1_t)) 1j
3368 if self._ptr == NULL: 1j
3369 raise MemoryError("Error allocating C2cModeInfo_v1")
3370 self._owner = None 1j
3371 self._owned = True 1j
3372 self._readonly = False 1j
3374 def __dealloc__(self):
3375 cdef nvmlC2cModeInfo_v1_t *ptr
3376 if self._owned and self._ptr != NULL: 1j
3377 ptr = self._ptr 1j
3378 self._ptr = NULL 1j
3379 free(ptr) 1j
3381 def __repr__(self):
3382 return f"<{__name__}.C2cModeInfo_v1 object at {hex(id(self))}>"
3384 @property
3385 def ptr(self):
3386 """Get the pointer address to the data as Python :class:`int`."""
3387 return <intptr_t>(self._ptr)
3389 cdef intptr_t _get_ptr(self):
3390 return <intptr_t>(self._ptr) 1j
3392 def __int__(self):
3393 return <intptr_t>(self._ptr)
3395 def __eq__(self, other):
3396 cdef C2cModeInfo_v1 other_
3397 if not isinstance(other, C2cModeInfo_v1):
3398 return False
3399 other_ = other
3400 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlC2cModeInfo_v1_t)) == 0)
3402 def __setitem__(self, key, val):
3403 if key == 0 and isinstance(val, _numpy.ndarray):
3404 self._ptr = <nvmlC2cModeInfo_v1_t *>malloc(sizeof(nvmlC2cModeInfo_v1_t))
3405 if self._ptr == NULL:
3406 raise MemoryError("Error allocating C2cModeInfo_v1")
3407 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlC2cModeInfo_v1_t))
3408 self._owner = None
3409 self._owned = True
3410 self._readonly = not val.flags.writeable
3411 else:
3412 setattr(self, key, val)
3414 @property
3415 def is_c2c_enabled(self):
3416 """int: """
3417 return self._ptr[0].isC2cEnabled
3419 @is_c2c_enabled.setter
3420 def is_c2c_enabled(self, val):
3421 if self._readonly:
3422 raise ValueError("This C2cModeInfo_v1 instance is read-only")
3423 self._ptr[0].isC2cEnabled = val
3425 @staticmethod
3426 def from_data(data):
3427 """Create an C2cModeInfo_v1 instance wrapping the given NumPy array.
3429 Args:
3430 data (_numpy.ndarray): a single-element array of dtype `c2c_mode_info_v1_dtype` holding the data.
3431 """
3432 return __from_data(data, "c2c_mode_info_v1_dtype", c2c_mode_info_v1_dtype, C2cModeInfo_v1)
3434 @staticmethod
3435 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
3436 """Create an C2cModeInfo_v1 instance wrapping the given pointer.
3438 Args:
3439 ptr (intptr_t): pointer address as Python :class:`int` to the data.
3440 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
3441 readonly (bool): whether the data is read-only (to the user). default is `False`.
3442 """
3443 if ptr == 0:
3444 raise ValueError("ptr must not be null (0)")
3445 cdef C2cModeInfo_v1 obj = C2cModeInfo_v1.__new__(C2cModeInfo_v1)
3446 if owner is None:
3447 obj._ptr = <nvmlC2cModeInfo_v1_t *>malloc(sizeof(nvmlC2cModeInfo_v1_t))
3448 if obj._ptr == NULL:
3449 raise MemoryError("Error allocating C2cModeInfo_v1")
3450 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlC2cModeInfo_v1_t))
3451 obj._owner = None
3452 obj._owned = True
3453 else:
3454 obj._ptr = <nvmlC2cModeInfo_v1_t *>ptr
3455 obj._owner = owner
3456 obj._owned = False
3457 obj._readonly = readonly
3458 return obj
3461cdef _get_row_remapper_histogram_values_dtype_offsets():
3462 cdef nvmlRowRemapperHistogramValues_t pod = nvmlRowRemapperHistogramValues_t()
3463 return _numpy.dtype({
3464 'names': ['max_', 'high', 'partial', 'low', 'none'],
3465 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
3466 'offsets': [
3467 (<intptr_t>&(pod.max)) - (<intptr_t>&pod),
3468 (<intptr_t>&(pod.high)) - (<intptr_t>&pod),
3469 (<intptr_t>&(pod.partial)) - (<intptr_t>&pod),
3470 (<intptr_t>&(pod.low)) - (<intptr_t>&pod),
3471 (<intptr_t>&(pod.none)) - (<intptr_t>&pod),
3472 ],
3473 'itemsize': sizeof(nvmlRowRemapperHistogramValues_t),
3474 })
3476row_remapper_histogram_values_dtype = _get_row_remapper_histogram_values_dtype_offsets()
3478cdef class RowRemapperHistogramValues:
3479 """Empty-initialize an instance of `nvmlRowRemapperHistogramValues_t`.
3482 .. seealso:: `nvmlRowRemapperHistogramValues_t`
3483 """
3484 cdef:
3485 nvmlRowRemapperHistogramValues_t *_ptr
3486 object _owner
3487 bint _owned
3488 bint _readonly
3490 def __init__(self):
3491 self._ptr = <nvmlRowRemapperHistogramValues_t *>calloc(1, sizeof(nvmlRowRemapperHistogramValues_t))
3492 if self._ptr == NULL:
3493 raise MemoryError("Error allocating RowRemapperHistogramValues")
3494 self._owner = None
3495 self._owned = True
3496 self._readonly = False
3498 def __dealloc__(self):
3499 cdef nvmlRowRemapperHistogramValues_t *ptr
3500 if self._owned and self._ptr != NULL:
3501 ptr = self._ptr
3502 self._ptr = NULL
3503 free(ptr)
3505 def __repr__(self):
3506 return f"<{__name__}.RowRemapperHistogramValues object at {hex(id(self))}>"
3508 @property
3509 def ptr(self):
3510 """Get the pointer address to the data as Python :class:`int`."""
3511 return <intptr_t>(self._ptr)
3513 cdef intptr_t _get_ptr(self):
3514 return <intptr_t>(self._ptr)
3516 def __int__(self):
3517 return <intptr_t>(self._ptr)
3519 def __eq__(self, other):
3520 cdef RowRemapperHistogramValues other_
3521 if not isinstance(other, RowRemapperHistogramValues):
3522 return False
3523 other_ = other
3524 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlRowRemapperHistogramValues_t)) == 0)
3526 def __setitem__(self, key, val):
3527 if key == 0 and isinstance(val, _numpy.ndarray):
3528 self._ptr = <nvmlRowRemapperHistogramValues_t *>malloc(sizeof(nvmlRowRemapperHistogramValues_t))
3529 if self._ptr == NULL:
3530 raise MemoryError("Error allocating RowRemapperHistogramValues")
3531 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlRowRemapperHistogramValues_t))
3532 self._owner = None
3533 self._owned = True
3534 self._readonly = not val.flags.writeable
3535 else:
3536 setattr(self, key, val)
3538 @property
3539 def max_(self):
3540 """int: """
3541 return self._ptr[0].max
3543 @max_.setter
3544 def max_(self, val):
3545 if self._readonly:
3546 raise ValueError("This RowRemapperHistogramValues instance is read-only")
3547 self._ptr[0].max = val
3549 @property
3550 def high(self):
3551 """int: """
3552 return self._ptr[0].high
3554 @high.setter
3555 def high(self, val):
3556 if self._readonly:
3557 raise ValueError("This RowRemapperHistogramValues instance is read-only")
3558 self._ptr[0].high = val
3560 @property
3561 def partial(self):
3562 """int: """
3563 return self._ptr[0].partial
3565 @partial.setter
3566 def partial(self, val):
3567 if self._readonly:
3568 raise ValueError("This RowRemapperHistogramValues instance is read-only")
3569 self._ptr[0].partial = val
3571 @property
3572 def low(self):
3573 """int: """
3574 return self._ptr[0].low
3576 @low.setter
3577 def low(self, val):
3578 if self._readonly:
3579 raise ValueError("This RowRemapperHistogramValues instance is read-only")
3580 self._ptr[0].low = val
3582 @property
3583 def none(self):
3584 """int: """
3585 return self._ptr[0].none
3587 @none.setter
3588 def none(self, val):
3589 if self._readonly:
3590 raise ValueError("This RowRemapperHistogramValues instance is read-only")
3591 self._ptr[0].none = val
3593 @staticmethod
3594 def from_data(data):
3595 """Create an RowRemapperHistogramValues instance wrapping the given NumPy array.
3597 Args:
3598 data (_numpy.ndarray): a single-element array of dtype `row_remapper_histogram_values_dtype` holding the data.
3599 """
3600 return __from_data(data, "row_remapper_histogram_values_dtype", row_remapper_histogram_values_dtype, RowRemapperHistogramValues)
3602 @staticmethod
3603 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
3604 """Create an RowRemapperHistogramValues instance wrapping the given pointer.
3606 Args:
3607 ptr (intptr_t): pointer address as Python :class:`int` to the data.
3608 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
3609 readonly (bool): whether the data is read-only (to the user). default is `False`.
3610 """
3611 if ptr == 0:
3612 raise ValueError("ptr must not be null (0)")
3613 cdef RowRemapperHistogramValues obj = RowRemapperHistogramValues.__new__(RowRemapperHistogramValues)
3614 if owner is None:
3615 obj._ptr = <nvmlRowRemapperHistogramValues_t *>malloc(sizeof(nvmlRowRemapperHistogramValues_t))
3616 if obj._ptr == NULL:
3617 raise MemoryError("Error allocating RowRemapperHistogramValues")
3618 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlRowRemapperHistogramValues_t))
3619 obj._owner = None
3620 obj._owned = True
3621 else:
3622 obj._ptr = <nvmlRowRemapperHistogramValues_t *>ptr
3623 obj._owner = owner
3624 obj._owned = False
3625 obj._readonly = readonly
3626 return obj
3629cdef _get_bridge_chip_info_dtype_offsets():
3630 cdef nvmlBridgeChipInfo_t pod = nvmlBridgeChipInfo_t()
3631 return _numpy.dtype({
3632 'names': ['type', 'fw_version'],
3633 'formats': [_numpy.int32, _numpy.uint32],
3634 'offsets': [
3635 (<intptr_t>&(pod.type)) - (<intptr_t>&pod),
3636 (<intptr_t>&(pod.fwVersion)) - (<intptr_t>&pod),
3637 ],
3638 'itemsize': sizeof(nvmlBridgeChipInfo_t),
3639 })
3641bridge_chip_info_dtype = _get_bridge_chip_info_dtype_offsets()
3643cdef class BridgeChipInfo:
3644 """Empty-initialize an array of `nvmlBridgeChipInfo_t`.
3646 The resulting object is of length `size` and of dtype `bridge_chip_info_dtype`.
3647 If default-constructed, the instance represents a single struct.
3649 Args:
3650 size (int): number of structs, default=1.
3653 .. seealso:: `nvmlBridgeChipInfo_t`
3654 """
3655 cdef:
3656 readonly object _data
3660 def __init__(self, size=1):
3661 arr = _numpy.empty(size, dtype=bridge_chip_info_dtype)
3662 self._data = arr.view(_numpy.recarray)
3663 assert self._data.itemsize == sizeof(nvmlBridgeChipInfo_t), \
3664 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlBridgeChipInfo_t) }"
3666 def __repr__(self):
3667 if self._data.size > 1:
3668 return f"<{__name__}.BridgeChipInfo_Array_{self._data.size} object at {hex(id(self))}>"
3669 else:
3670 return f"<{__name__}.BridgeChipInfo object at {hex(id(self))}>"
3672 @property
3673 def ptr(self):
3674 """Get the pointer address to the data as Python :class:`int`."""
3675 return self._data.ctypes.data
3677 cdef intptr_t _get_ptr(self):
3678 return self._data.ctypes.data
3680 def __int__(self):
3681 if self._data.size > 1:
3682 raise TypeError("int() argument must be a bytes-like object of size 1. "
3683 "To get the pointer address of an array, use .ptr")
3684 return self._data.ctypes.data
3686 def __len__(self):
3687 return self._data.size 12
3689 def __eq__(self, other):
3690 cdef object self_data = self._data
3691 if (not isinstance(other, BridgeChipInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
3692 return False
3693 return bool((self_data == other._data).all())
3695 @property
3696 def type(self):
3697 """Union[~_numpy.int32, int]: """
3698 if self._data.size == 1:
3699 return int(self._data.type[0])
3700 return self._data.type
3702 @type.setter
3703 def type(self, val):
3704 self._data.type = val
3706 @property
3707 def fw_version(self):
3708 """Union[~_numpy.uint32, int]: """
3709 if self._data.size == 1:
3710 return int(self._data.fw_version[0])
3711 return self._data.fw_version
3713 @fw_version.setter
3714 def fw_version(self, val):
3715 self._data.fw_version = val
3717 def __getitem__(self, key):
3718 cdef ssize_t key_
3719 cdef ssize_t size
3720 if isinstance(key, int):
3721 key_ = key
3722 size = self._data.size
3723 if key_ >= size or key_ <= -(size+1):
3724 raise IndexError("index is out of bounds")
3725 if key_ < 0:
3726 key_ += size
3727 return BridgeChipInfo.from_data(self._data[key_:key_+1])
3728 out = self._data[key]
3729 if isinstance(out, _numpy.recarray) and out.dtype == bridge_chip_info_dtype:
3730 return BridgeChipInfo.from_data(out)
3731 return out
3733 def __setitem__(self, key, val):
3734 self._data[key] = val
3736 @staticmethod
3737 def from_data(data):
3738 """Create an BridgeChipInfo instance wrapping the given NumPy array.
3740 Args:
3741 data (_numpy.ndarray): a 1D array of dtype `bridge_chip_info_dtype` holding the data.
3742 """
3743 cdef BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo)
3744 if not isinstance(data, _numpy.ndarray):
3745 raise TypeError("data argument must be a NumPy ndarray")
3746 if data.ndim != 1:
3747 raise ValueError("data array must be 1D")
3748 if data.dtype != bridge_chip_info_dtype:
3749 raise ValueError("data array must be of dtype bridge_chip_info_dtype")
3750 obj._data = data.view(_numpy.recarray)
3752 return obj
3754 @staticmethod
3755 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
3756 """Create an BridgeChipInfo instance wrapping the given pointer.
3758 Args:
3759 ptr (intptr_t): pointer address as Python :class:`int` to the data.
3760 size (int): number of structs, default=1.
3761 readonly (bool): whether the data is read-only (to the user). default is `False`.
3762 """
3763 if ptr == 0: 12
3764 raise ValueError("ptr must not be null (0)")
3765 cdef BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo) 12
3766 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE 12
3767 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( 12
3768 <char*>ptr, sizeof(nvmlBridgeChipInfo_t) * size, flag) 12
3769 data = _numpy.ndarray(size, buffer=buf, dtype=bridge_chip_info_dtype) 12
3770 obj._data = data.view(_numpy.recarray) 12
3772 return obj 12
3775value_dtype = _numpy.dtype((
3776 _numpy.dtype((_numpy.void, sizeof(nvmlValue_t))),
3777 {
3778 "d_val": (_numpy.float64, 0),
3779 "si_val": (_numpy.int32, 0),
3780 "ui_val": (_numpy.uint32, 0),
3781 "ul_val": (_numpy.uint32, 0),
3782 "ull_val": (_numpy.uint64, 0),
3783 "sll_val": (_numpy.int64, 0),
3784 "us_val": (_numpy.uint16, 0),
3785 }
3786 ))
3789cdef class Value:
3790 """Empty-initialize an instance of `nvmlValue_t`.
3793 .. seealso:: `nvmlValue_t`
3794 """
3795 cdef:
3796 nvmlValue_t *_ptr
3797 object _owner
3798 bint _owned
3799 bint _readonly
3801 def __init__(self):
3802 self._ptr = <nvmlValue_t *>calloc(1, sizeof(nvmlValue_t))
3803 if self._ptr == NULL:
3804 raise MemoryError("Error allocating Value")
3805 self._owner = None
3806 self._owned = True
3807 self._readonly = False
3809 def __dealloc__(self):
3810 cdef nvmlValue_t *ptr
3811 if self._owned and self._ptr != NULL:
3812 ptr = self._ptr
3813 self._ptr = NULL
3814 free(ptr)
3816 def __repr__(self):
3817 return f"<{__name__}.Value object at {hex(id(self))}>"
3819 @property
3820 def ptr(self):
3821 """Get the pointer address to the data as Python :class:`int`."""
3822 return <intptr_t>(self._ptr)
3824 cdef intptr_t _get_ptr(self):
3825 return <intptr_t>(self._ptr)
3827 def __int__(self):
3828 return <intptr_t>(self._ptr)
3830 def __eq__(self, other):
3831 cdef Value other_
3832 if not isinstance(other, Value):
3833 return False
3834 other_ = other
3835 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlValue_t)) == 0)
3837 def __setitem__(self, key, val):
3838 if key == 0 and isinstance(val, _numpy.ndarray):
3839 self._ptr = <nvmlValue_t *>malloc(sizeof(nvmlValue_t))
3840 if self._ptr == NULL:
3841 raise MemoryError("Error allocating Value")
3842 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlValue_t))
3843 self._owner = None
3844 self._owned = True
3845 self._readonly = not val.flags.writeable
3846 else:
3847 setattr(self, key, val)
3849 @property
3850 def d_val(self):
3851 """float: """
3852 return self._ptr[0].dVal
3854 @d_val.setter
3855 def d_val(self, val):
3856 if self._readonly:
3857 raise ValueError("This Value instance is read-only")
3858 self._ptr[0].dVal = val
3860 @property
3861 def si_val(self):
3862 """int: """
3863 return self._ptr[0].siVal
3865 @si_val.setter
3866 def si_val(self, val):
3867 if self._readonly:
3868 raise ValueError("This Value instance is read-only")
3869 self._ptr[0].siVal = val
3871 @property
3872 def ui_val(self):
3873 """int: """
3874 return self._ptr[0].uiVal
3876 @ui_val.setter
3877 def ui_val(self, val):
3878 if self._readonly:
3879 raise ValueError("This Value instance is read-only")
3880 self._ptr[0].uiVal = val
3882 @property
3883 def ul_val(self):
3884 """int: """
3885 return self._ptr[0].ulVal
3887 @ul_val.setter
3888 def ul_val(self, val):
3889 if self._readonly:
3890 raise ValueError("This Value instance is read-only")
3891 self._ptr[0].ulVal = val
3893 @property
3894 def ull_val(self):
3895 """int: """
3896 return self._ptr[0].ullVal
3898 @ull_val.setter
3899 def ull_val(self, val):
3900 if self._readonly:
3901 raise ValueError("This Value instance is read-only")
3902 self._ptr[0].ullVal = val
3904 @property
3905 def sll_val(self):
3906 """int: """
3907 return self._ptr[0].sllVal
3909 @sll_val.setter
3910 def sll_val(self, val):
3911 if self._readonly:
3912 raise ValueError("This Value instance is read-only")
3913 self._ptr[0].sllVal = val
3915 @property
3916 def us_val(self):
3917 """int: """
3918 return self._ptr[0].usVal
3920 @us_val.setter
3921 def us_val(self, val):
3922 if self._readonly:
3923 raise ValueError("This Value instance is read-only")
3924 self._ptr[0].usVal = val
3926 @staticmethod
3927 def from_data(data):
3928 """Create an Value instance wrapping the given NumPy array.
3930 Args:
3931 data (_numpy.ndarray): a single-element array of dtype `value_dtype` holding the data.
3932 """
3933 return __from_data(data, "value_dtype", value_dtype, Value)
3935 @staticmethod
3936 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
3937 """Create an Value instance wrapping the given pointer.
3939 Args:
3940 ptr (intptr_t): pointer address as Python :class:`int` to the data.
3941 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
3942 readonly (bool): whether the data is read-only (to the user). default is `False`.
3943 """
3944 if ptr == 0:
3945 raise ValueError("ptr must not be null (0)")
3946 cdef Value obj = Value.__new__(Value)
3947 if owner is None:
3948 obj._ptr = <nvmlValue_t *>malloc(sizeof(nvmlValue_t))
3949 if obj._ptr == NULL:
3950 raise MemoryError("Error allocating Value")
3951 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlValue_t))
3952 obj._owner = None
3953 obj._owned = True
3954 else:
3955 obj._ptr = <nvmlValue_t *>ptr
3956 obj._owner = owner
3957 obj._owned = False
3958 obj._readonly = readonly
3959 return obj
3962cdef _get__py_anon_pod0_dtype_offsets():
3963 cdef _anon_pod0 pod = _anon_pod0()
3964 return _numpy.dtype({
3965 'names': ['controller', 'default_min_temp', 'default_max_temp', 'current_temp', 'target'],
3966 'formats': [_numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32],
3967 'offsets': [
3968 (<intptr_t>&(pod.controller)) - (<intptr_t>&pod),
3969 (<intptr_t>&(pod.defaultMinTemp)) - (<intptr_t>&pod),
3970 (<intptr_t>&(pod.defaultMaxTemp)) - (<intptr_t>&pod),
3971 (<intptr_t>&(pod.currentTemp)) - (<intptr_t>&pod),
3972 (<intptr_t>&(pod.target)) - (<intptr_t>&pod),
3973 ],
3974 'itemsize': sizeof(_anon_pod0),
3975 })
3977_py_anon_pod0_dtype = _get__py_anon_pod0_dtype_offsets()
3979cdef class _py_anon_pod0:
3980 """Empty-initialize an instance of `_anon_pod0`.
3983 .. seealso:: `_anon_pod0`
3984 """
3985 cdef:
3986 _anon_pod0 *_ptr
3987 object _owner
3988 bint _owned
3989 bint _readonly
3991 def __init__(self):
3992 self._ptr = <_anon_pod0 *>calloc(1, sizeof(_anon_pod0))
3993 if self._ptr == NULL:
3994 raise MemoryError("Error allocating _py_anon_pod0")
3995 self._owner = None
3996 self._owned = True
3997 self._readonly = False
3999 def __dealloc__(self):
4000 cdef _anon_pod0 *ptr
4001 if self._owned and self._ptr != NULL:
4002 ptr = self._ptr
4003 self._ptr = NULL
4004 free(ptr)
4006 def __repr__(self):
4007 return f"<{__name__}._py_anon_pod0 object at {hex(id(self))}>"
4009 @property
4010 def ptr(self):
4011 """Get the pointer address to the data as Python :class:`int`."""
4012 return <intptr_t>(self._ptr)
4014 cdef intptr_t _get_ptr(self):
4015 return <intptr_t>(self._ptr)
4017 def __int__(self):
4018 return <intptr_t>(self._ptr)
4020 def __eq__(self, other):
4021 cdef _py_anon_pod0 other_
4022 if not isinstance(other, _py_anon_pod0):
4023 return False
4024 other_ = other
4025 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(_anon_pod0)) == 0)
4027 def __setitem__(self, key, val):
4028 if key == 0 and isinstance(val, _numpy.ndarray):
4029 self._ptr = <_anon_pod0 *>malloc(sizeof(_anon_pod0))
4030 if self._ptr == NULL:
4031 raise MemoryError("Error allocating _py_anon_pod0")
4032 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(_anon_pod0))
4033 self._owner = None
4034 self._owned = True
4035 self._readonly = not val.flags.writeable
4036 else:
4037 setattr(self, key, val)
4039 @property
4040 def controller(self):
4041 """int: """
4042 return <int>(self._ptr[0].controller)
4044 @controller.setter
4045 def controller(self, val):
4046 if self._readonly:
4047 raise ValueError("This _py_anon_pod0 instance is read-only")
4048 self._ptr[0].controller = <nvmlThermalController_t><int>val
4050 @property
4051 def default_min_temp(self):
4052 """int: """
4053 return self._ptr[0].defaultMinTemp
4055 @default_min_temp.setter
4056 def default_min_temp(self, val):
4057 if self._readonly:
4058 raise ValueError("This _py_anon_pod0 instance is read-only")
4059 self._ptr[0].defaultMinTemp = val
4061 @property
4062 def default_max_temp(self):
4063 """int: """
4064 return self._ptr[0].defaultMaxTemp
4066 @default_max_temp.setter
4067 def default_max_temp(self, val):
4068 if self._readonly:
4069 raise ValueError("This _py_anon_pod0 instance is read-only")
4070 self._ptr[0].defaultMaxTemp = val
4072 @property
4073 def current_temp(self):
4074 """int: """
4075 return self._ptr[0].currentTemp
4077 @current_temp.setter
4078 def current_temp(self, val):
4079 if self._readonly:
4080 raise ValueError("This _py_anon_pod0 instance is read-only")
4081 self._ptr[0].currentTemp = val
4083 @property
4084 def target(self):
4085 """int: """
4086 return <int>(self._ptr[0].target)
4088 @target.setter
4089 def target(self, val):
4090 if self._readonly:
4091 raise ValueError("This _py_anon_pod0 instance is read-only")
4092 self._ptr[0].target = <nvmlThermalTarget_t><int>val
4094 @staticmethod
4095 def from_data(data):
4096 """Create an _py_anon_pod0 instance wrapping the given NumPy array.
4098 Args:
4099 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod0_dtype` holding the data.
4100 """
4101 return __from_data(data, "_py_anon_pod0_dtype", _py_anon_pod0_dtype, _py_anon_pod0)
4103 @staticmethod
4104 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
4105 """Create an _py_anon_pod0 instance wrapping the given pointer.
4107 Args:
4108 ptr (intptr_t): pointer address as Python :class:`int` to the data.
4109 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
4110 readonly (bool): whether the data is read-only (to the user). default is `False`.
4111 """
4112 if ptr == 0:
4113 raise ValueError("ptr must not be null (0)")
4114 cdef _py_anon_pod0 obj = _py_anon_pod0.__new__(_py_anon_pod0)
4115 if owner is None:
4116 obj._ptr = <_anon_pod0 *>malloc(sizeof(_anon_pod0))
4117 if obj._ptr == NULL:
4118 raise MemoryError("Error allocating _py_anon_pod0")
4119 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(_anon_pod0))
4120 obj._owner = None
4121 obj._owned = True
4122 else:
4123 obj._ptr = <_anon_pod0 *>ptr
4124 obj._owner = owner
4125 obj._owned = False
4126 obj._readonly = readonly
4127 return obj
4130cdef _get_cooler_info_v1_dtype_offsets():
4131 cdef nvmlCoolerInfo_v1_t pod = nvmlCoolerInfo_v1_t()
4132 return _numpy.dtype({
4133 'names': ['version', 'ind_ex', 'signal_type', 'target'],
4134 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.int32],
4135 'offsets': [
4136 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
4137 (<intptr_t>&(pod.index)) - (<intptr_t>&pod),
4138 (<intptr_t>&(pod.signalType)) - (<intptr_t>&pod),
4139 (<intptr_t>&(pod.target)) - (<intptr_t>&pod),
4140 ],
4141 'itemsize': sizeof(nvmlCoolerInfo_v1_t),
4142 })
4144cooler_info_v1_dtype = _get_cooler_info_v1_dtype_offsets()
4146cdef class CoolerInfo_v1:
4147 """Empty-initialize an instance of `nvmlCoolerInfo_v1_t`.
4150 .. seealso:: `nvmlCoolerInfo_v1_t`
4151 """
4152 cdef:
4153 nvmlCoolerInfo_v1_t *_ptr
4154 object _owner
4155 bint _owned
4156 bint _readonly
4158 def __init__(self):
4159 self._ptr = <nvmlCoolerInfo_v1_t *>calloc(1, sizeof(nvmlCoolerInfo_v1_t))
4160 if self._ptr == NULL:
4161 raise MemoryError("Error allocating CoolerInfo_v1")
4162 self._owner = None
4163 self._owned = True
4164 self._readonly = False
4166 def __dealloc__(self):
4167 cdef nvmlCoolerInfo_v1_t *ptr
4168 if self._owned and self._ptr != NULL:
4169 ptr = self._ptr
4170 self._ptr = NULL
4171 free(ptr)
4173 def __repr__(self):
4174 return f"<{__name__}.CoolerInfo_v1 object at {hex(id(self))}>"
4176 @property
4177 def ptr(self):
4178 """Get the pointer address to the data as Python :class:`int`."""
4179 return <intptr_t>(self._ptr)
4181 cdef intptr_t _get_ptr(self):
4182 return <intptr_t>(self._ptr)
4184 def __int__(self):
4185 return <intptr_t>(self._ptr)
4187 def __eq__(self, other):
4188 cdef CoolerInfo_v1 other_
4189 if not isinstance(other, CoolerInfo_v1):
4190 return False
4191 other_ = other
4192 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlCoolerInfo_v1_t)) == 0)
4194 def __setitem__(self, key, val):
4195 if key == 0 and isinstance(val, _numpy.ndarray):
4196 self._ptr = <nvmlCoolerInfo_v1_t *>malloc(sizeof(nvmlCoolerInfo_v1_t))
4197 if self._ptr == NULL:
4198 raise MemoryError("Error allocating CoolerInfo_v1")
4199 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlCoolerInfo_v1_t))
4200 self._owner = None
4201 self._owned = True
4202 self._readonly = not val.flags.writeable
4203 else:
4204 setattr(self, key, val)
4206 @property
4207 def version(self):
4208 """int: the API version number"""
4209 return self._ptr[0].version
4211 @version.setter
4212 def version(self, val):
4213 if self._readonly:
4214 raise ValueError("This CoolerInfo_v1 instance is read-only")
4215 self._ptr[0].version = val
4217 @property
4218 def ind_ex(self):
4219 """int: the cooler index"""
4220 return self._ptr[0].index
4222 @ind_ex.setter
4223 def ind_ex(self, val):
4224 if self._readonly:
4225 raise ValueError("This CoolerInfo_v1 instance is read-only")
4226 self._ptr[0].index = val
4228 @property
4229 def signal_type(self):
4230 """int: OUT: the cooler's control signal characteristics."""
4231 return <int>(self._ptr[0].signalType)
4233 @signal_type.setter
4234 def signal_type(self, val):
4235 if self._readonly:
4236 raise ValueError("This CoolerInfo_v1 instance is read-only")
4237 self._ptr[0].signalType = <nvmlCoolerControl_t><int>val
4239 @property
4240 def target(self):
4241 """int: OUT: the target that cooler cools."""
4242 return <int>(self._ptr[0].target)
4244 @target.setter
4245 def target(self, val):
4246 if self._readonly:
4247 raise ValueError("This CoolerInfo_v1 instance is read-only")
4248 self._ptr[0].target = <nvmlCoolerTarget_t><int>val
4250 @staticmethod
4251 def from_data(data):
4252 """Create an CoolerInfo_v1 instance wrapping the given NumPy array.
4254 Args:
4255 data (_numpy.ndarray): a single-element array of dtype `cooler_info_v1_dtype` holding the data.
4256 """
4257 return __from_data(data, "cooler_info_v1_dtype", cooler_info_v1_dtype, CoolerInfo_v1)
4259 @staticmethod
4260 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
4261 """Create an CoolerInfo_v1 instance wrapping the given pointer.
4263 Args:
4264 ptr (intptr_t): pointer address as Python :class:`int` to the data.
4265 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
4266 readonly (bool): whether the data is read-only (to the user). default is `False`.
4267 """
4268 if ptr == 0:
4269 raise ValueError("ptr must not be null (0)")
4270 cdef CoolerInfo_v1 obj = CoolerInfo_v1.__new__(CoolerInfo_v1)
4271 if owner is None:
4272 obj._ptr = <nvmlCoolerInfo_v1_t *>malloc(sizeof(nvmlCoolerInfo_v1_t))
4273 if obj._ptr == NULL:
4274 raise MemoryError("Error allocating CoolerInfo_v1")
4275 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlCoolerInfo_v1_t))
4276 obj._owner = None
4277 obj._owned = True
4278 else:
4279 obj._ptr = <nvmlCoolerInfo_v1_t *>ptr
4280 obj._owner = owner
4281 obj._owned = False
4282 obj._readonly = readonly
4283 return obj
4286cdef _get_clk_mon_fault_info_dtype_offsets():
4287 cdef nvmlClkMonFaultInfo_t pod = nvmlClkMonFaultInfo_t()
4288 return _numpy.dtype({
4289 'names': ['clk_api_domain', 'clk_domain_fault_mask'],
4290 'formats': [_numpy.uint32, _numpy.uint32],
4291 'offsets': [
4292 (<intptr_t>&(pod.clkApiDomain)) - (<intptr_t>&pod),
4293 (<intptr_t>&(pod.clkDomainFaultMask)) - (<intptr_t>&pod),
4294 ],
4295 'itemsize': sizeof(nvmlClkMonFaultInfo_t),
4296 })
4298clk_mon_fault_info_dtype = _get_clk_mon_fault_info_dtype_offsets()
4300cdef class ClkMonFaultInfo:
4301 """Empty-initialize an array of `nvmlClkMonFaultInfo_t`.
4303 The resulting object is of length `size` and of dtype `clk_mon_fault_info_dtype`.
4304 If default-constructed, the instance represents a single struct.
4306 Args:
4307 size (int): number of structs, default=1.
4310 .. seealso:: `nvmlClkMonFaultInfo_t`
4311 """
4312 cdef:
4313 readonly object _data
4317 def __init__(self, size=1):
4318 arr = _numpy.empty(size, dtype=clk_mon_fault_info_dtype)
4319 self._data = arr.view(_numpy.recarray)
4320 assert self._data.itemsize == sizeof(nvmlClkMonFaultInfo_t), \
4321 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlClkMonFaultInfo_t) }"
4323 def __repr__(self):
4324 if self._data.size > 1:
4325 return f"<{__name__}.ClkMonFaultInfo_Array_{self._data.size} object at {hex(id(self))}>"
4326 else:
4327 return f"<{__name__}.ClkMonFaultInfo object at {hex(id(self))}>"
4329 @property
4330 def ptr(self):
4331 """Get the pointer address to the data as Python :class:`int`."""
4332 return self._data.ctypes.data
4334 cdef intptr_t _get_ptr(self):
4335 return self._data.ctypes.data
4337 def __int__(self):
4338 if self._data.size > 1:
4339 raise TypeError("int() argument must be a bytes-like object of size 1. "
4340 "To get the pointer address of an array, use .ptr")
4341 return self._data.ctypes.data
4343 def __len__(self):
4344 return self._data.size 13
4346 def __eq__(self, other):
4347 cdef object self_data = self._data
4348 if (not isinstance(other, ClkMonFaultInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
4349 return False
4350 return bool((self_data == other._data).all())
4352 @property
4353 def clk_api_domain(self):
4354 """Union[~_numpy.uint32, int]: """
4355 if self._data.size == 1:
4356 return int(self._data.clk_api_domain[0])
4357 return self._data.clk_api_domain
4359 @clk_api_domain.setter
4360 def clk_api_domain(self, val):
4361 self._data.clk_api_domain = val
4363 @property
4364 def clk_domain_fault_mask(self):
4365 """Union[~_numpy.uint32, int]: """
4366 if self._data.size == 1:
4367 return int(self._data.clk_domain_fault_mask[0])
4368 return self._data.clk_domain_fault_mask
4370 @clk_domain_fault_mask.setter
4371 def clk_domain_fault_mask(self, val):
4372 self._data.clk_domain_fault_mask = val
4374 def __getitem__(self, key):
4375 cdef ssize_t key_
4376 cdef ssize_t size
4377 if isinstance(key, int):
4378 key_ = key
4379 size = self._data.size
4380 if key_ >= size or key_ <= -(size+1):
4381 raise IndexError("index is out of bounds")
4382 if key_ < 0:
4383 key_ += size
4384 return ClkMonFaultInfo.from_data(self._data[key_:key_+1])
4385 out = self._data[key]
4386 if isinstance(out, _numpy.recarray) and out.dtype == clk_mon_fault_info_dtype:
4387 return ClkMonFaultInfo.from_data(out)
4388 return out
4390 def __setitem__(self, key, val):
4391 self._data[key] = val
4393 @staticmethod
4394 def from_data(data):
4395 """Create an ClkMonFaultInfo instance wrapping the given NumPy array.
4397 Args:
4398 data (_numpy.ndarray): a 1D array of dtype `clk_mon_fault_info_dtype` holding the data.
4399 """
4400 cdef ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo)
4401 if not isinstance(data, _numpy.ndarray):
4402 raise TypeError("data argument must be a NumPy ndarray")
4403 if data.ndim != 1:
4404 raise ValueError("data array must be 1D")
4405 if data.dtype != clk_mon_fault_info_dtype:
4406 raise ValueError("data array must be of dtype clk_mon_fault_info_dtype")
4407 obj._data = data.view(_numpy.recarray)
4409 return obj
4411 @staticmethod
4412 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
4413 """Create an ClkMonFaultInfo instance wrapping the given pointer.
4415 Args:
4416 ptr (intptr_t): pointer address as Python :class:`int` to the data.
4417 size (int): number of structs, default=1.
4418 readonly (bool): whether the data is read-only (to the user). default is `False`.
4419 """
4420 if ptr == 0: 13
4421 raise ValueError("ptr must not be null (0)")
4422 cdef ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) 13
4423 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE 13
4424 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( 13
4425 <char*>ptr, sizeof(nvmlClkMonFaultInfo_t) * size, flag) 13
4426 data = _numpy.ndarray(size, buffer=buf, dtype=clk_mon_fault_info_dtype) 13
4427 obj._data = data.view(_numpy.recarray) 13
4429 return obj 13
4432cdef _get_clock_offset_v1_dtype_offsets():
4433 cdef nvmlClockOffset_v1_t pod = nvmlClockOffset_v1_t()
4434 return _numpy.dtype({
4435 'names': ['version', 'type', 'pstate', 'clock_offset_m_hz', 'min_clock_offset_m_hz', 'max_clock_offset_m_hz'],
4436 'formats': [_numpy.uint32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32],
4437 'offsets': [
4438 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
4439 (<intptr_t>&(pod.type)) - (<intptr_t>&pod),
4440 (<intptr_t>&(pod.pstate)) - (<intptr_t>&pod),
4441 (<intptr_t>&(pod.clockOffsetMHz)) - (<intptr_t>&pod),
4442 (<intptr_t>&(pod.minClockOffsetMHz)) - (<intptr_t>&pod),
4443 (<intptr_t>&(pod.maxClockOffsetMHz)) - (<intptr_t>&pod),
4444 ],
4445 'itemsize': sizeof(nvmlClockOffset_v1_t),
4446 })
4448clock_offset_v1_dtype = _get_clock_offset_v1_dtype_offsets()
4450cdef class ClockOffset_v1:
4451 """Empty-initialize an instance of `nvmlClockOffset_v1_t`.
4454 .. seealso:: `nvmlClockOffset_v1_t`
4455 """
4456 cdef:
4457 nvmlClockOffset_v1_t *_ptr
4458 object _owner
4459 bint _owned
4460 bint _readonly
4462 def __init__(self):
4463 self._ptr = <nvmlClockOffset_v1_t *>calloc(1, sizeof(nvmlClockOffset_v1_t)) 1b
4464 if self._ptr == NULL: 1b
4465 raise MemoryError("Error allocating ClockOffset_v1")
4466 self._owner = None 1b
4467 self._owned = True 1b
4468 self._readonly = False 1b
4470 def __dealloc__(self):
4471 cdef nvmlClockOffset_v1_t *ptr
4472 if self._owned and self._ptr != NULL: 1b
4473 ptr = self._ptr 1b
4474 self._ptr = NULL 1b
4475 free(ptr) 1b
4477 def __repr__(self):
4478 return f"<{__name__}.ClockOffset_v1 object at {hex(id(self))}>"
4480 @property
4481 def ptr(self):
4482 """Get the pointer address to the data as Python :class:`int`."""
4483 return <intptr_t>(self._ptr)
4485 cdef intptr_t _get_ptr(self):
4486 return <intptr_t>(self._ptr) 1b
4488 def __int__(self):
4489 return <intptr_t>(self._ptr)
4491 def __eq__(self, other):
4492 cdef ClockOffset_v1 other_
4493 if not isinstance(other, ClockOffset_v1):
4494 return False
4495 other_ = other
4496 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlClockOffset_v1_t)) == 0)
4498 def __setitem__(self, key, val):
4499 if key == 0 and isinstance(val, _numpy.ndarray):
4500 self._ptr = <nvmlClockOffset_v1_t *>malloc(sizeof(nvmlClockOffset_v1_t))
4501 if self._ptr == NULL:
4502 raise MemoryError("Error allocating ClockOffset_v1")
4503 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlClockOffset_v1_t))
4504 self._owner = None
4505 self._owned = True
4506 self._readonly = not val.flags.writeable
4507 else:
4508 setattr(self, key, val)
4510 @property
4511 def version(self):
4512 """int: The version number of this struct."""
4513 return self._ptr[0].version
4515 @version.setter
4516 def version(self, val):
4517 if self._readonly:
4518 raise ValueError("This ClockOffset_v1 instance is read-only")
4519 self._ptr[0].version = val
4521 @property
4522 def type(self):
4523 """int: """
4524 return <int>(self._ptr[0].type)
4526 @type.setter
4527 def type(self, val):
4528 if self._readonly:
4529 raise ValueError("This ClockOffset_v1 instance is read-only")
4530 self._ptr[0].type = <nvmlClockType_t><int>val
4532 @property
4533 def pstate(self):
4534 """int: """
4535 return <int>(self._ptr[0].pstate)
4537 @pstate.setter
4538 def pstate(self, val):
4539 if self._readonly:
4540 raise ValueError("This ClockOffset_v1 instance is read-only")
4541 self._ptr[0].pstate = <nvmlPstates_t><int>val
4543 @property
4544 def clock_offset_m_hz(self):
4545 """int: """
4546 return self._ptr[0].clockOffsetMHz 1b
4548 @clock_offset_m_hz.setter
4549 def clock_offset_m_hz(self, val):
4550 if self._readonly:
4551 raise ValueError("This ClockOffset_v1 instance is read-only")
4552 self._ptr[0].clockOffsetMHz = val
4554 @property
4555 def min_clock_offset_m_hz(self):
4556 """int: """
4557 return self._ptr[0].minClockOffsetMHz 1b
4559 @min_clock_offset_m_hz.setter
4560 def min_clock_offset_m_hz(self, val):
4561 if self._readonly:
4562 raise ValueError("This ClockOffset_v1 instance is read-only")
4563 self._ptr[0].minClockOffsetMHz = val
4565 @property
4566 def max_clock_offset_m_hz(self):
4567 """int: """
4568 return self._ptr[0].maxClockOffsetMHz 1b
4570 @max_clock_offset_m_hz.setter
4571 def max_clock_offset_m_hz(self, val):
4572 if self._readonly:
4573 raise ValueError("This ClockOffset_v1 instance is read-only")
4574 self._ptr[0].maxClockOffsetMHz = val
4576 @staticmethod
4577 def from_data(data):
4578 """Create an ClockOffset_v1 instance wrapping the given NumPy array.
4580 Args:
4581 data (_numpy.ndarray): a single-element array of dtype `clock_offset_v1_dtype` holding the data.
4582 """
4583 return __from_data(data, "clock_offset_v1_dtype", clock_offset_v1_dtype, ClockOffset_v1)
4585 @staticmethod
4586 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
4587 """Create an ClockOffset_v1 instance wrapping the given pointer.
4589 Args:
4590 ptr (intptr_t): pointer address as Python :class:`int` to the data.
4591 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
4592 readonly (bool): whether the data is read-only (to the user). default is `False`.
4593 """
4594 if ptr == 0:
4595 raise ValueError("ptr must not be null (0)")
4596 cdef ClockOffset_v1 obj = ClockOffset_v1.__new__(ClockOffset_v1)
4597 if owner is None:
4598 obj._ptr = <nvmlClockOffset_v1_t *>malloc(sizeof(nvmlClockOffset_v1_t))
4599 if obj._ptr == NULL:
4600 raise MemoryError("Error allocating ClockOffset_v1")
4601 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlClockOffset_v1_t))
4602 obj._owner = None
4603 obj._owned = True
4604 else:
4605 obj._ptr = <nvmlClockOffset_v1_t *>ptr
4606 obj._owner = owner
4607 obj._owned = False
4608 obj._readonly = readonly
4609 return obj
4612cdef _get_process_utilization_sample_dtype_offsets():
4613 cdef nvmlProcessUtilizationSample_t pod = nvmlProcessUtilizationSample_t()
4614 return _numpy.dtype({
4615 'names': ['pid', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'],
4616 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
4617 'offsets': [
4618 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
4619 (<intptr_t>&(pod.timeStamp)) - (<intptr_t>&pod),
4620 (<intptr_t>&(pod.smUtil)) - (<intptr_t>&pod),
4621 (<intptr_t>&(pod.memUtil)) - (<intptr_t>&pod),
4622 (<intptr_t>&(pod.encUtil)) - (<intptr_t>&pod),
4623 (<intptr_t>&(pod.decUtil)) - (<intptr_t>&pod),
4624 ],
4625 'itemsize': sizeof(nvmlProcessUtilizationSample_t),
4626 })
4628process_utilization_sample_dtype = _get_process_utilization_sample_dtype_offsets()
4630cdef class ProcessUtilizationSample:
4631 """Empty-initialize an array of `nvmlProcessUtilizationSample_t`.
4633 The resulting object is of length `size` and of dtype `process_utilization_sample_dtype`.
4634 If default-constructed, the instance represents a single struct.
4636 Args:
4637 size (int): number of structs, default=1.
4640 .. seealso:: `nvmlProcessUtilizationSample_t`
4641 """
4642 cdef:
4643 readonly object _data
4647 def __init__(self, size=1):
4648 arr = _numpy.empty(size, dtype=process_utilization_sample_dtype)
4649 self._data = arr.view(_numpy.recarray)
4650 assert self._data.itemsize == sizeof(nvmlProcessUtilizationSample_t), \
4651 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessUtilizationSample_t) }"
4653 def __repr__(self):
4654 if self._data.size > 1:
4655 return f"<{__name__}.ProcessUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>"
4656 else:
4657 return f"<{__name__}.ProcessUtilizationSample object at {hex(id(self))}>"
4659 @property
4660 def ptr(self):
4661 """Get the pointer address to the data as Python :class:`int`."""
4662 return self._data.ctypes.data
4664 cdef intptr_t _get_ptr(self):
4665 return self._data.ctypes.data
4667 def __int__(self):
4668 if self._data.size > 1:
4669 raise TypeError("int() argument must be a bytes-like object of size 1. "
4670 "To get the pointer address of an array, use .ptr")
4671 return self._data.ctypes.data
4673 def __len__(self):
4674 return self._data.size
4676 def __eq__(self, other):
4677 cdef object self_data = self._data
4678 if (not isinstance(other, ProcessUtilizationSample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
4679 return False
4680 return bool((self_data == other._data).all())
4682 @property
4683 def pid(self):
4684 """Union[~_numpy.uint32, int]: """
4685 if self._data.size == 1:
4686 return int(self._data.pid[0])
4687 return self._data.pid
4689 @pid.setter
4690 def pid(self, val):
4691 self._data.pid = val
4693 @property
4694 def time_stamp(self):
4695 """Union[~_numpy.uint64, int]: """
4696 if self._data.size == 1:
4697 return int(self._data.time_stamp[0])
4698 return self._data.time_stamp
4700 @time_stamp.setter
4701 def time_stamp(self, val):
4702 self._data.time_stamp = val
4704 @property
4705 def sm_util(self):
4706 """Union[~_numpy.uint32, int]: """
4707 if self._data.size == 1:
4708 return int(self._data.sm_util[0])
4709 return self._data.sm_util
4711 @sm_util.setter
4712 def sm_util(self, val):
4713 self._data.sm_util = val
4715 @property
4716 def mem_util(self):
4717 """Union[~_numpy.uint32, int]: """
4718 if self._data.size == 1:
4719 return int(self._data.mem_util[0])
4720 return self._data.mem_util
4722 @mem_util.setter
4723 def mem_util(self, val):
4724 self._data.mem_util = val
4726 @property
4727 def enc_util(self):
4728 """Union[~_numpy.uint32, int]: """
4729 if self._data.size == 1:
4730 return int(self._data.enc_util[0])
4731 return self._data.enc_util
4733 @enc_util.setter
4734 def enc_util(self, val):
4735 self._data.enc_util = val
4737 @property
4738 def dec_util(self):
4739 """Union[~_numpy.uint32, int]: """
4740 if self._data.size == 1:
4741 return int(self._data.dec_util[0])
4742 return self._data.dec_util
4744 @dec_util.setter
4745 def dec_util(self, val):
4746 self._data.dec_util = val
4748 def __getitem__(self, key):
4749 cdef ssize_t key_
4750 cdef ssize_t size
4751 if isinstance(key, int):
4752 key_ = key
4753 size = self._data.size
4754 if key_ >= size or key_ <= -(size+1):
4755 raise IndexError("index is out of bounds")
4756 if key_ < 0:
4757 key_ += size
4758 return ProcessUtilizationSample.from_data(self._data[key_:key_+1])
4759 out = self._data[key]
4760 if isinstance(out, _numpy.recarray) and out.dtype == process_utilization_sample_dtype:
4761 return ProcessUtilizationSample.from_data(out)
4762 return out
4764 def __setitem__(self, key, val):
4765 self._data[key] = val
4767 @staticmethod
4768 def from_data(data):
4769 """Create an ProcessUtilizationSample instance wrapping the given NumPy array.
4771 Args:
4772 data (_numpy.ndarray): a 1D array of dtype `process_utilization_sample_dtype` holding the data.
4773 """
4774 cdef ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample)
4775 if not isinstance(data, _numpy.ndarray):
4776 raise TypeError("data argument must be a NumPy ndarray")
4777 if data.ndim != 1:
4778 raise ValueError("data array must be 1D")
4779 if data.dtype != process_utilization_sample_dtype:
4780 raise ValueError("data array must be of dtype process_utilization_sample_dtype")
4781 obj._data = data.view(_numpy.recarray)
4783 return obj
4785 @staticmethod
4786 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
4787 """Create an ProcessUtilizationSample instance wrapping the given pointer.
4789 Args:
4790 ptr (intptr_t): pointer address as Python :class:`int` to the data.
4791 size (int): number of structs, default=1.
4792 readonly (bool): whether the data is read-only (to the user). default is `False`.
4793 """
4794 if ptr == 0:
4795 raise ValueError("ptr must not be null (0)")
4796 cdef ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample)
4797 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
4798 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
4799 <char*>ptr, sizeof(nvmlProcessUtilizationSample_t) * size, flag)
4800 data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_sample_dtype)
4801 obj._data = data.view(_numpy.recarray)
4803 return obj
4806cdef _get_process_utilization_info_v1_dtype_offsets():
4807 cdef nvmlProcessUtilizationInfo_v1_t pod = nvmlProcessUtilizationInfo_v1_t()
4808 return _numpy.dtype({
4809 'names': ['time_stamp', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'],
4810 'formats': [_numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
4811 'offsets': [
4812 (<intptr_t>&(pod.timeStamp)) - (<intptr_t>&pod),
4813 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
4814 (<intptr_t>&(pod.smUtil)) - (<intptr_t>&pod),
4815 (<intptr_t>&(pod.memUtil)) - (<intptr_t>&pod),
4816 (<intptr_t>&(pod.encUtil)) - (<intptr_t>&pod),
4817 (<intptr_t>&(pod.decUtil)) - (<intptr_t>&pod),
4818 (<intptr_t>&(pod.jpgUtil)) - (<intptr_t>&pod),
4819 (<intptr_t>&(pod.ofaUtil)) - (<intptr_t>&pod),
4820 ],
4821 'itemsize': sizeof(nvmlProcessUtilizationInfo_v1_t),
4822 })
4824process_utilization_info_v1_dtype = _get_process_utilization_info_v1_dtype_offsets()
4826cdef class ProcessUtilizationInfo_v1:
4827 """Empty-initialize an array of `nvmlProcessUtilizationInfo_v1_t`.
4829 The resulting object is of length `size` and of dtype `process_utilization_info_v1_dtype`.
4830 If default-constructed, the instance represents a single struct.
4832 Args:
4833 size (int): number of structs, default=1.
4836 .. seealso:: `nvmlProcessUtilizationInfo_v1_t`
4837 """
4838 cdef:
4839 readonly object _data
4843 def __init__(self, size=1):
4844 arr = _numpy.empty(size, dtype=process_utilization_info_v1_dtype)
4845 self._data = arr.view(_numpy.recarray)
4846 assert self._data.itemsize == sizeof(nvmlProcessUtilizationInfo_v1_t), \
4847 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessUtilizationInfo_v1_t) }"
4849 def __repr__(self):
4850 if self._data.size > 1:
4851 return f"<{__name__}.ProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>"
4852 else:
4853 return f"<{__name__}.ProcessUtilizationInfo_v1 object at {hex(id(self))}>"
4855 @property
4856 def ptr(self):
4857 """Get the pointer address to the data as Python :class:`int`."""
4858 return self._data.ctypes.data
4860 cdef intptr_t _get_ptr(self):
4861 return self._data.ctypes.data
4863 def __int__(self):
4864 if self._data.size > 1:
4865 raise TypeError("int() argument must be a bytes-like object of size 1. "
4866 "To get the pointer address of an array, use .ptr")
4867 return self._data.ctypes.data
4869 def __len__(self):
4870 return self._data.size
4872 def __eq__(self, other):
4873 cdef object self_data = self._data
4874 if (not isinstance(other, ProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
4875 return False
4876 return bool((self_data == other._data).all())
4878 @property
4879 def time_stamp(self):
4880 """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds."""
4881 if self._data.size == 1:
4882 return int(self._data.time_stamp[0])
4883 return self._data.time_stamp
4885 @time_stamp.setter
4886 def time_stamp(self, val):
4887 self._data.time_stamp = val
4889 @property
4890 def pid(self):
4891 """Union[~_numpy.uint32, int]: PID of process."""
4892 if self._data.size == 1:
4893 return int(self._data.pid[0])
4894 return self._data.pid
4896 @pid.setter
4897 def pid(self, val):
4898 self._data.pid = val
4900 @property
4901 def sm_util(self):
4902 """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value."""
4903 if self._data.size == 1:
4904 return int(self._data.sm_util[0])
4905 return self._data.sm_util
4907 @sm_util.setter
4908 def sm_util(self, val):
4909 self._data.sm_util = val
4911 @property
4912 def mem_util(self):
4913 """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value."""
4914 if self._data.size == 1:
4915 return int(self._data.mem_util[0])
4916 return self._data.mem_util
4918 @mem_util.setter
4919 def mem_util(self, val):
4920 self._data.mem_util = val
4922 @property
4923 def enc_util(self):
4924 """Union[~_numpy.uint32, int]: Encoder Util Value."""
4925 if self._data.size == 1:
4926 return int(self._data.enc_util[0])
4927 return self._data.enc_util
4929 @enc_util.setter
4930 def enc_util(self, val):
4931 self._data.enc_util = val
4933 @property
4934 def dec_util(self):
4935 """Union[~_numpy.uint32, int]: Decoder Util Value."""
4936 if self._data.size == 1:
4937 return int(self._data.dec_util[0])
4938 return self._data.dec_util
4940 @dec_util.setter
4941 def dec_util(self, val):
4942 self._data.dec_util = val
4944 @property
4945 def jpg_util(self):
4946 """Union[~_numpy.uint32, int]: Jpeg Util Value."""
4947 if self._data.size == 1:
4948 return int(self._data.jpg_util[0])
4949 return self._data.jpg_util
4951 @jpg_util.setter
4952 def jpg_util(self, val):
4953 self._data.jpg_util = val
4955 @property
4956 def ofa_util(self):
4957 """Union[~_numpy.uint32, int]: Ofa Util Value."""
4958 if self._data.size == 1:
4959 return int(self._data.ofa_util[0])
4960 return self._data.ofa_util
4962 @ofa_util.setter
4963 def ofa_util(self, val):
4964 self._data.ofa_util = val
4966 def __getitem__(self, key):
4967 cdef ssize_t key_
4968 cdef ssize_t size
4969 if isinstance(key, int):
4970 key_ = key
4971 size = self._data.size
4972 if key_ >= size or key_ <= -(size+1):
4973 raise IndexError("index is out of bounds")
4974 if key_ < 0:
4975 key_ += size
4976 return ProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1])
4977 out = self._data[key]
4978 if isinstance(out, _numpy.recarray) and out.dtype == process_utilization_info_v1_dtype:
4979 return ProcessUtilizationInfo_v1.from_data(out)
4980 return out
4982 def __setitem__(self, key, val):
4983 self._data[key] = val
4985 @staticmethod
4986 def from_data(data):
4987 """Create an ProcessUtilizationInfo_v1 instance wrapping the given NumPy array.
4989 Args:
4990 data (_numpy.ndarray): a 1D array of dtype `process_utilization_info_v1_dtype` holding the data.
4991 """
4992 cdef ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_v1)
4993 if not isinstance(data, _numpy.ndarray):
4994 raise TypeError("data argument must be a NumPy ndarray")
4995 if data.ndim != 1:
4996 raise ValueError("data array must be 1D")
4997 if data.dtype != process_utilization_info_v1_dtype:
4998 raise ValueError("data array must be of dtype process_utilization_info_v1_dtype")
4999 obj._data = data.view(_numpy.recarray)
5001 return obj
5003 @staticmethod
5004 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
5005 """Create an ProcessUtilizationInfo_v1 instance wrapping the given pointer.
5007 Args:
5008 ptr (intptr_t): pointer address as Python :class:`int` to the data.
5009 size (int): number of structs, default=1.
5010 readonly (bool): whether the data is read-only (to the user). default is `False`.
5011 """
5012 if ptr == 0:
5013 raise ValueError("ptr must not be null (0)")
5014 cdef ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_v1)
5015 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
5016 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
5017 <char*>ptr, sizeof(nvmlProcessUtilizationInfo_v1_t) * size, flag)
5018 data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_info_v1_dtype)
5019 obj._data = data.view(_numpy.recarray)
5021 return obj
5024cdef _get_ecc_sram_error_status_v1_dtype_offsets():
5025 cdef nvmlEccSramErrorStatus_v1_t pod = nvmlEccSramErrorStatus_v1_t()
5026 return _numpy.dtype({
5027 'names': ['version', 'aggregate_unc_parity', 'aggregate_unc_sec_ded', 'aggregate_cor', 'volatile_unc_parity', 'volatile_unc_sec_ded', 'volatile_cor', 'aggregate_unc_bucket_l2', 'aggregate_unc_bucket_sm', 'aggregate_unc_bucket_pcie', 'aggregate_unc_bucket_mcu', 'aggregate_unc_bucket_other', 'b_threshold_exceeded'],
5028 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32],
5029 'offsets': [
5030 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
5031 (<intptr_t>&(pod.aggregateUncParity)) - (<intptr_t>&pod),
5032 (<intptr_t>&(pod.aggregateUncSecDed)) - (<intptr_t>&pod),
5033 (<intptr_t>&(pod.aggregateCor)) - (<intptr_t>&pod),
5034 (<intptr_t>&(pod.volatileUncParity)) - (<intptr_t>&pod),
5035 (<intptr_t>&(pod.volatileUncSecDed)) - (<intptr_t>&pod),
5036 (<intptr_t>&(pod.volatileCor)) - (<intptr_t>&pod),
5037 (<intptr_t>&(pod.aggregateUncBucketL2)) - (<intptr_t>&pod),
5038 (<intptr_t>&(pod.aggregateUncBucketSm)) - (<intptr_t>&pod),
5039 (<intptr_t>&(pod.aggregateUncBucketPcie)) - (<intptr_t>&pod),
5040 (<intptr_t>&(pod.aggregateUncBucketMcu)) - (<intptr_t>&pod),
5041 (<intptr_t>&(pod.aggregateUncBucketOther)) - (<intptr_t>&pod),
5042 (<intptr_t>&(pod.bThresholdExceeded)) - (<intptr_t>&pod),
5043 ],
5044 'itemsize': sizeof(nvmlEccSramErrorStatus_v1_t),
5045 })
5047ecc_sram_error_status_v1_dtype = _get_ecc_sram_error_status_v1_dtype_offsets()
5049cdef class EccSramErrorStatus_v1:
5050 """Empty-initialize an instance of `nvmlEccSramErrorStatus_v1_t`.
5053 .. seealso:: `nvmlEccSramErrorStatus_v1_t`
5054 """
5055 cdef:
5056 nvmlEccSramErrorStatus_v1_t *_ptr
5057 object _owner
5058 bint _owned
5059 bint _readonly
5061 def __init__(self):
5062 self._ptr = <nvmlEccSramErrorStatus_v1_t *>calloc(1, sizeof(nvmlEccSramErrorStatus_v1_t))
5063 if self._ptr == NULL:
5064 raise MemoryError("Error allocating EccSramErrorStatus_v1")
5065 self._owner = None
5066 self._owned = True
5067 self._readonly = False
5069 def __dealloc__(self):
5070 cdef nvmlEccSramErrorStatus_v1_t *ptr
5071 if self._owned and self._ptr != NULL:
5072 ptr = self._ptr
5073 self._ptr = NULL
5074 free(ptr)
5076 def __repr__(self):
5077 return f"<{__name__}.EccSramErrorStatus_v1 object at {hex(id(self))}>"
5079 @property
5080 def ptr(self):
5081 """Get the pointer address to the data as Python :class:`int`."""
5082 return <intptr_t>(self._ptr)
5084 cdef intptr_t _get_ptr(self):
5085 return <intptr_t>(self._ptr)
5087 def __int__(self):
5088 return <intptr_t>(self._ptr)
5090 def __eq__(self, other):
5091 cdef EccSramErrorStatus_v1 other_
5092 if not isinstance(other, EccSramErrorStatus_v1):
5093 return False
5094 other_ = other
5095 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlEccSramErrorStatus_v1_t)) == 0)
5097 def __setitem__(self, key, val):
5098 if key == 0 and isinstance(val, _numpy.ndarray):
5099 self._ptr = <nvmlEccSramErrorStatus_v1_t *>malloc(sizeof(nvmlEccSramErrorStatus_v1_t))
5100 if self._ptr == NULL:
5101 raise MemoryError("Error allocating EccSramErrorStatus_v1")
5102 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlEccSramErrorStatus_v1_t))
5103 self._owner = None
5104 self._owned = True
5105 self._readonly = not val.flags.writeable
5106 else:
5107 setattr(self, key, val)
5109 @property
5110 def version(self):
5111 """int: the API version number"""
5112 return self._ptr[0].version
5114 @version.setter
5115 def version(self, val):
5116 if self._readonly:
5117 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5118 self._ptr[0].version = val
5120 @property
5121 def aggregate_unc_parity(self):
5122 """int: aggregate uncorrectable parity error count"""
5123 return self._ptr[0].aggregateUncParity
5125 @aggregate_unc_parity.setter
5126 def aggregate_unc_parity(self, val):
5127 if self._readonly:
5128 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5129 self._ptr[0].aggregateUncParity = val
5131 @property
5132 def aggregate_unc_sec_ded(self):
5133 """int: aggregate uncorrectable SEC-DED error count"""
5134 return self._ptr[0].aggregateUncSecDed
5136 @aggregate_unc_sec_ded.setter
5137 def aggregate_unc_sec_ded(self, val):
5138 if self._readonly:
5139 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5140 self._ptr[0].aggregateUncSecDed = val
5142 @property
5143 def aggregate_cor(self):
5144 """int: aggregate correctable error count"""
5145 return self._ptr[0].aggregateCor
5147 @aggregate_cor.setter
5148 def aggregate_cor(self, val):
5149 if self._readonly:
5150 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5151 self._ptr[0].aggregateCor = val
5153 @property
5154 def volatile_unc_parity(self):
5155 """int: volatile uncorrectable parity error count"""
5156 return self._ptr[0].volatileUncParity
5158 @volatile_unc_parity.setter
5159 def volatile_unc_parity(self, val):
5160 if self._readonly:
5161 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5162 self._ptr[0].volatileUncParity = val
5164 @property
5165 def volatile_unc_sec_ded(self):
5166 """int: volatile uncorrectable SEC-DED error count"""
5167 return self._ptr[0].volatileUncSecDed
5169 @volatile_unc_sec_ded.setter
5170 def volatile_unc_sec_ded(self, val):
5171 if self._readonly:
5172 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5173 self._ptr[0].volatileUncSecDed = val
5175 @property
5176 def volatile_cor(self):
5177 """int: volatile correctable error count"""
5178 return self._ptr[0].volatileCor
5180 @volatile_cor.setter
5181 def volatile_cor(self, val):
5182 if self._readonly:
5183 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5184 self._ptr[0].volatileCor = val
5186 @property
5187 def aggregate_unc_bucket_l2(self):
5188 """int: aggregate uncorrectable error count for L2 cache bucket"""
5189 return self._ptr[0].aggregateUncBucketL2
5191 @aggregate_unc_bucket_l2.setter
5192 def aggregate_unc_bucket_l2(self, val):
5193 if self._readonly:
5194 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5195 self._ptr[0].aggregateUncBucketL2 = val
5197 @property
5198 def aggregate_unc_bucket_sm(self):
5199 """int: aggregate uncorrectable error count for SM bucket"""
5200 return self._ptr[0].aggregateUncBucketSm
5202 @aggregate_unc_bucket_sm.setter
5203 def aggregate_unc_bucket_sm(self, val):
5204 if self._readonly:
5205 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5206 self._ptr[0].aggregateUncBucketSm = val
5208 @property
5209 def aggregate_unc_bucket_pcie(self):
5210 """int: aggregate uncorrectable error count for PCIE bucket"""
5211 return self._ptr[0].aggregateUncBucketPcie
5213 @aggregate_unc_bucket_pcie.setter
5214 def aggregate_unc_bucket_pcie(self, val):
5215 if self._readonly:
5216 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5217 self._ptr[0].aggregateUncBucketPcie = val
5219 @property
5220 def aggregate_unc_bucket_mcu(self):
5221 """int: aggregate uncorrectable error count for Microcontroller bucket"""
5222 return self._ptr[0].aggregateUncBucketMcu
5224 @aggregate_unc_bucket_mcu.setter
5225 def aggregate_unc_bucket_mcu(self, val):
5226 if self._readonly:
5227 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5228 self._ptr[0].aggregateUncBucketMcu = val
5230 @property
5231 def aggregate_unc_bucket_other(self):
5232 """int: aggregate uncorrectable error count for Other bucket"""
5233 return self._ptr[0].aggregateUncBucketOther
5235 @aggregate_unc_bucket_other.setter
5236 def aggregate_unc_bucket_other(self, val):
5237 if self._readonly:
5238 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5239 self._ptr[0].aggregateUncBucketOther = val
5241 @property
5242 def b_threshold_exceeded(self):
5243 """int: if the error threshold of field diag is exceeded"""
5244 return self._ptr[0].bThresholdExceeded
5246 @b_threshold_exceeded.setter
5247 def b_threshold_exceeded(self, val):
5248 if self._readonly:
5249 raise ValueError("This EccSramErrorStatus_v1 instance is read-only")
5250 self._ptr[0].bThresholdExceeded = val
5252 @staticmethod
5253 def from_data(data):
5254 """Create an EccSramErrorStatus_v1 instance wrapping the given NumPy array.
5256 Args:
5257 data (_numpy.ndarray): a single-element array of dtype `ecc_sram_error_status_v1_dtype` holding the data.
5258 """
5259 return __from_data(data, "ecc_sram_error_status_v1_dtype", ecc_sram_error_status_v1_dtype, EccSramErrorStatus_v1)
5261 @staticmethod
5262 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
5263 """Create an EccSramErrorStatus_v1 instance wrapping the given pointer.
5265 Args:
5266 ptr (intptr_t): pointer address as Python :class:`int` to the data.
5267 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
5268 readonly (bool): whether the data is read-only (to the user). default is `False`.
5269 """
5270 if ptr == 0:
5271 raise ValueError("ptr must not be null (0)")
5272 cdef EccSramErrorStatus_v1 obj = EccSramErrorStatus_v1.__new__(EccSramErrorStatus_v1)
5273 if owner is None:
5274 obj._ptr = <nvmlEccSramErrorStatus_v1_t *>malloc(sizeof(nvmlEccSramErrorStatus_v1_t))
5275 if obj._ptr == NULL:
5276 raise MemoryError("Error allocating EccSramErrorStatus_v1")
5277 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlEccSramErrorStatus_v1_t))
5278 obj._owner = None
5279 obj._owned = True
5280 else:
5281 obj._ptr = <nvmlEccSramErrorStatus_v1_t *>ptr
5282 obj._owner = owner
5283 obj._owned = False
5284 obj._readonly = readonly
5285 return obj
5288cdef _get_platform_info_v1_dtype_offsets():
5289 cdef nvmlPlatformInfo_v1_t pod = nvmlPlatformInfo_v1_t()
5290 return _numpy.dtype({
5291 'names': ['version', 'ib_guid', 'rack_guid', 'chassis_physical_slot_number', 'compute_slot_ind_ex', 'node_ind_ex', 'peer_type', 'module_id'],
5292 'formats': [_numpy.uint32, (_numpy.uint8, 16), (_numpy.uint8, 16), _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8],
5293 'offsets': [
5294 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
5295 (<intptr_t>&(pod.ibGuid)) - (<intptr_t>&pod),
5296 (<intptr_t>&(pod.rackGuid)) - (<intptr_t>&pod),
5297 (<intptr_t>&(pod.chassisPhysicalSlotNumber)) - (<intptr_t>&pod),
5298 (<intptr_t>&(pod.computeSlotIndex)) - (<intptr_t>&pod),
5299 (<intptr_t>&(pod.nodeIndex)) - (<intptr_t>&pod),
5300 (<intptr_t>&(pod.peerType)) - (<intptr_t>&pod),
5301 (<intptr_t>&(pod.moduleId)) - (<intptr_t>&pod),
5302 ],
5303 'itemsize': sizeof(nvmlPlatformInfo_v1_t),
5304 })
5306platform_info_v1_dtype = _get_platform_info_v1_dtype_offsets()
5308cdef class PlatformInfo_v1:
5309 """Empty-initialize an instance of `nvmlPlatformInfo_v1_t`.
5312 .. seealso:: `nvmlPlatformInfo_v1_t`
5313 """
5314 cdef:
5315 nvmlPlatformInfo_v1_t *_ptr
5316 object _owner
5317 bint _owned
5318 bint _readonly
5320 def __init__(self):
5321 self._ptr = <nvmlPlatformInfo_v1_t *>calloc(1, sizeof(nvmlPlatformInfo_v1_t))
5322 if self._ptr == NULL:
5323 raise MemoryError("Error allocating PlatformInfo_v1")
5324 self._owner = None
5325 self._owned = True
5326 self._readonly = False
5328 def __dealloc__(self):
5329 cdef nvmlPlatformInfo_v1_t *ptr
5330 if self._owned and self._ptr != NULL:
5331 ptr = self._ptr
5332 self._ptr = NULL
5333 free(ptr)
5335 def __repr__(self):
5336 return f"<{__name__}.PlatformInfo_v1 object at {hex(id(self))}>"
5338 @property
5339 def ptr(self):
5340 """Get the pointer address to the data as Python :class:`int`."""
5341 return <intptr_t>(self._ptr)
5343 cdef intptr_t _get_ptr(self):
5344 return <intptr_t>(self._ptr)
5346 def __int__(self):
5347 return <intptr_t>(self._ptr)
5349 def __eq__(self, other):
5350 cdef PlatformInfo_v1 other_
5351 if not isinstance(other, PlatformInfo_v1):
5352 return False
5353 other_ = other
5354 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPlatformInfo_v1_t)) == 0)
5356 def __setitem__(self, key, val):
5357 if key == 0 and isinstance(val, _numpy.ndarray):
5358 self._ptr = <nvmlPlatformInfo_v1_t *>malloc(sizeof(nvmlPlatformInfo_v1_t))
5359 if self._ptr == NULL:
5360 raise MemoryError("Error allocating PlatformInfo_v1")
5361 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPlatformInfo_v1_t))
5362 self._owner = None
5363 self._owned = True
5364 self._readonly = not val.flags.writeable
5365 else:
5366 setattr(self, key, val)
5368 @property
5369 def version(self):
5370 """int: the API version number"""
5371 return self._ptr[0].version
5373 @version.setter
5374 def version(self, val):
5375 if self._readonly:
5376 raise ValueError("This PlatformInfo_v1 instance is read-only")
5377 self._ptr[0].version = val
5379 @property
5380 def ib_guid(self):
5381 """~_numpy.uint8: (array of length 16).Infiniband GUID reported by platform (for Blackwell, ibGuid is 8 bytes so indices 8-15 are zero)"""
5382 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
5383 arr.data = <char *>(&(self._ptr[0].ibGuid))
5384 return _numpy.asarray(arr)
5386 @ib_guid.setter
5387 def ib_guid(self, val):
5388 if self._readonly:
5389 raise ValueError("This PlatformInfo_v1 instance is read-only")
5390 if len(val) != 16:
5391 raise ValueError(f"Expected length { 16 } for field ib_guid, got {len(val)}")
5392 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c")
5393 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
5394 memcpy(<void *>(&(self._ptr[0].ibGuid)), <void *>(arr.data), sizeof(unsigned char) * len(val))
5396 @property
5397 def rack_guid(self):
5398 """~_numpy.uint8: (array of length 16).GUID of the rack containing this GPU (for Blackwell rackGuid is 13 bytes so indices 13-15 are zero)"""
5399 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
5400 arr.data = <char *>(&(self._ptr[0].rackGuid))
5401 return _numpy.asarray(arr)
5403 @rack_guid.setter
5404 def rack_guid(self, val):
5405 if self._readonly:
5406 raise ValueError("This PlatformInfo_v1 instance is read-only")
5407 if len(val) != 16:
5408 raise ValueError(f"Expected length { 16 } for field rack_guid, got {len(val)}")
5409 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c")
5410 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
5411 memcpy(<void *>(&(self._ptr[0].rackGuid)), <void *>(arr.data), sizeof(unsigned char) * len(val))
5413 @property
5414 def chassis_physical_slot_number(self):
5415 """int: The slot number in the rack containing this GPU (includes switches)"""
5416 return self._ptr[0].chassisPhysicalSlotNumber
5418 @chassis_physical_slot_number.setter
5419 def chassis_physical_slot_number(self, val):
5420 if self._readonly:
5421 raise ValueError("This PlatformInfo_v1 instance is read-only")
5422 self._ptr[0].chassisPhysicalSlotNumber = val
5424 @property
5425 def compute_slot_ind_ex(self):
5426 """int: The index within the compute slots in the rack containing this GPU (does not include switches)"""
5427 return self._ptr[0].computeSlotIndex
5429 @compute_slot_ind_ex.setter
5430 def compute_slot_ind_ex(self, val):
5431 if self._readonly:
5432 raise ValueError("This PlatformInfo_v1 instance is read-only")
5433 self._ptr[0].computeSlotIndex = val
5435 @property
5436 def node_ind_ex(self):
5437 """int: Index of the node within the slot containing this GPU."""
5438 return self._ptr[0].nodeIndex
5440 @node_ind_ex.setter
5441 def node_ind_ex(self, val):
5442 if self._readonly:
5443 raise ValueError("This PlatformInfo_v1 instance is read-only")
5444 self._ptr[0].nodeIndex = val
5446 @property
5447 def peer_type(self):
5448 """int: Platform indicated NVLink-peer type (e.g. switch present or not)"""
5449 return self._ptr[0].peerType
5451 @peer_type.setter
5452 def peer_type(self, val):
5453 if self._readonly:
5454 raise ValueError("This PlatformInfo_v1 instance is read-only")
5455 self._ptr[0].peerType = val
5457 @property
5458 def module_id(self):
5459 """int: ID of this GPU within the node."""
5460 return self._ptr[0].moduleId
5462 @module_id.setter
5463 def module_id(self, val):
5464 if self._readonly:
5465 raise ValueError("This PlatformInfo_v1 instance is read-only")
5466 self._ptr[0].moduleId = val
5468 @staticmethod
5469 def from_data(data):
5470 """Create an PlatformInfo_v1 instance wrapping the given NumPy array.
5472 Args:
5473 data (_numpy.ndarray): a single-element array of dtype `platform_info_v1_dtype` holding the data.
5474 """
5475 return __from_data(data, "platform_info_v1_dtype", platform_info_v1_dtype, PlatformInfo_v1)
5477 @staticmethod
5478 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
5479 """Create an PlatformInfo_v1 instance wrapping the given pointer.
5481 Args:
5482 ptr (intptr_t): pointer address as Python :class:`int` to the data.
5483 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
5484 readonly (bool): whether the data is read-only (to the user). default is `False`.
5485 """
5486 if ptr == 0:
5487 raise ValueError("ptr must not be null (0)")
5488 cdef PlatformInfo_v1 obj = PlatformInfo_v1.__new__(PlatformInfo_v1)
5489 if owner is None:
5490 obj._ptr = <nvmlPlatformInfo_v1_t *>malloc(sizeof(nvmlPlatformInfo_v1_t))
5491 if obj._ptr == NULL:
5492 raise MemoryError("Error allocating PlatformInfo_v1")
5493 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPlatformInfo_v1_t))
5494 obj._owner = None
5495 obj._owned = True
5496 else:
5497 obj._ptr = <nvmlPlatformInfo_v1_t *>ptr
5498 obj._owner = owner
5499 obj._owned = False
5500 obj._readonly = readonly
5501 return obj
5504cdef _get_platform_info_v2_dtype_offsets():
5505 cdef nvmlPlatformInfo_v2_t pod = nvmlPlatformInfo_v2_t()
5506 return _numpy.dtype({
5507 'names': ['version', 'ib_guid', 'chassis_serial_number', 'slot_number', 'tray_ind_ex', 'host_id', 'peer_type', 'module_id'],
5508 'formats': [_numpy.uint32, (_numpy.uint8, 16), (_numpy.uint8, 16), _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8],
5509 'offsets': [
5510 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
5511 (<intptr_t>&(pod.ibGuid)) - (<intptr_t>&pod),
5512 (<intptr_t>&(pod.chassisSerialNumber)) - (<intptr_t>&pod),
5513 (<intptr_t>&(pod.slotNumber)) - (<intptr_t>&pod),
5514 (<intptr_t>&(pod.trayIndex)) - (<intptr_t>&pod),
5515 (<intptr_t>&(pod.hostId)) - (<intptr_t>&pod),
5516 (<intptr_t>&(pod.peerType)) - (<intptr_t>&pod),
5517 (<intptr_t>&(pod.moduleId)) - (<intptr_t>&pod),
5518 ],
5519 'itemsize': sizeof(nvmlPlatformInfo_v2_t),
5520 })
5522platform_info_v2_dtype = _get_platform_info_v2_dtype_offsets()
5524cdef class PlatformInfo_v2:
5525 """Empty-initialize an instance of `nvmlPlatformInfo_v2_t`.
5528 .. seealso:: `nvmlPlatformInfo_v2_t`
5529 """
5530 cdef:
5531 nvmlPlatformInfo_v2_t *_ptr
5532 object _owner
5533 bint _owned
5534 bint _readonly
5536 def __init__(self):
5537 self._ptr = <nvmlPlatformInfo_v2_t *>calloc(1, sizeof(nvmlPlatformInfo_v2_t)) 1D
5538 if self._ptr == NULL: 1D
5539 raise MemoryError("Error allocating PlatformInfo_v2")
5540 self._owner = None 1D
5541 self._owned = True 1D
5542 self._readonly = False 1D
5544 def __dealloc__(self):
5545 cdef nvmlPlatformInfo_v2_t *ptr
5546 if self._owned and self._ptr != NULL: 1D
5547 ptr = self._ptr 1D
5548 self._ptr = NULL 1D
5549 free(ptr) 1D
5551 def __repr__(self):
5552 return f"<{__name__}.PlatformInfo_v2 object at {hex(id(self))}>"
5554 @property
5555 def ptr(self):
5556 """Get the pointer address to the data as Python :class:`int`."""
5557 return <intptr_t>(self._ptr)
5559 cdef intptr_t _get_ptr(self):
5560 return <intptr_t>(self._ptr) 1D
5562 def __int__(self):
5563 return <intptr_t>(self._ptr)
5565 def __eq__(self, other):
5566 cdef PlatformInfo_v2 other_
5567 if not isinstance(other, PlatformInfo_v2):
5568 return False
5569 other_ = other
5570 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPlatformInfo_v2_t)) == 0)
5572 def __setitem__(self, key, val):
5573 if key == 0 and isinstance(val, _numpy.ndarray):
5574 self._ptr = <nvmlPlatformInfo_v2_t *>malloc(sizeof(nvmlPlatformInfo_v2_t))
5575 if self._ptr == NULL:
5576 raise MemoryError("Error allocating PlatformInfo_v2")
5577 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPlatformInfo_v2_t))
5578 self._owner = None
5579 self._owned = True
5580 self._readonly = not val.flags.writeable
5581 else:
5582 setattr(self, key, val)
5584 @property
5585 def version(self):
5586 """int: the API version number"""
5587 return self._ptr[0].version
5589 @version.setter
5590 def version(self, val):
5591 if self._readonly:
5592 raise ValueError("This PlatformInfo_v2 instance is read-only")
5593 self._ptr[0].version = val
5595 @property
5596 def ib_guid(self):
5597 """~_numpy.uint8: (array of length 16).Infiniband GUID reported by platform (for Blackwell, ibGuid is 8 bytes so indices 8-15 are zero)"""
5598 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
5599 arr.data = <char *>(&(self._ptr[0].ibGuid))
5600 return _numpy.asarray(arr)
5602 @ib_guid.setter
5603 def ib_guid(self, val):
5604 if self._readonly:
5605 raise ValueError("This PlatformInfo_v2 instance is read-only")
5606 if len(val) != 16:
5607 raise ValueError(f"Expected length { 16 } for field ib_guid, got {len(val)}")
5608 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c")
5609 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
5610 memcpy(<void *>(&(self._ptr[0].ibGuid)), <void *>(arr.data), sizeof(unsigned char) * len(val))
5612 @property
5613 def chassis_serial_number(self):
5614 """~_numpy.uint8: (array of length 16).Serial number of the chassis containing this GPU (for Blackwell it is 13 bytes so indices 13-15 are zero)"""
5615 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
5616 arr.data = <char *>(&(self._ptr[0].chassisSerialNumber))
5617 return _numpy.asarray(arr)
5619 @chassis_serial_number.setter
5620 def chassis_serial_number(self, val):
5621 if self._readonly:
5622 raise ValueError("This PlatformInfo_v2 instance is read-only")
5623 if len(val) != 16:
5624 raise ValueError(f"Expected length { 16 } for field chassis_serial_number, got {len(val)}")
5625 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c")
5626 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
5627 memcpy(<void *>(&(self._ptr[0].chassisSerialNumber)), <void *>(arr.data), sizeof(unsigned char) * len(val))
5629 @property
5630 def slot_number(self):
5631 """int: The slot number in the chassis containing this GPU (includes switches)"""
5632 return self._ptr[0].slotNumber
5634 @slot_number.setter
5635 def slot_number(self, val):
5636 if self._readonly:
5637 raise ValueError("This PlatformInfo_v2 instance is read-only")
5638 self._ptr[0].slotNumber = val
5640 @property
5641 def tray_ind_ex(self):
5642 """int: The tray index within the compute slots in the chassis containing this GPU (does not include switches)"""
5643 return self._ptr[0].trayIndex
5645 @tray_ind_ex.setter
5646 def tray_ind_ex(self, val):
5647 if self._readonly:
5648 raise ValueError("This PlatformInfo_v2 instance is read-only")
5649 self._ptr[0].trayIndex = val
5651 @property
5652 def host_id(self):
5653 """int: Index of the node within the slot containing this GPU."""
5654 return self._ptr[0].hostId
5656 @host_id.setter
5657 def host_id(self, val):
5658 if self._readonly:
5659 raise ValueError("This PlatformInfo_v2 instance is read-only")
5660 self._ptr[0].hostId = val
5662 @property
5663 def peer_type(self):
5664 """int: Platform indicated NVLink-peer type (e.g. switch present or not)"""
5665 return self._ptr[0].peerType
5667 @peer_type.setter
5668 def peer_type(self, val):
5669 if self._readonly:
5670 raise ValueError("This PlatformInfo_v2 instance is read-only")
5671 self._ptr[0].peerType = val
5673 @property
5674 def module_id(self):
5675 """int: ID of this GPU within the node."""
5676 return self._ptr[0].moduleId
5678 @module_id.setter
5679 def module_id(self, val):
5680 if self._readonly:
5681 raise ValueError("This PlatformInfo_v2 instance is read-only")
5682 self._ptr[0].moduleId = val
5684 @staticmethod
5685 def from_data(data):
5686 """Create an PlatformInfo_v2 instance wrapping the given NumPy array.
5688 Args:
5689 data (_numpy.ndarray): a single-element array of dtype `platform_info_v2_dtype` holding the data.
5690 """
5691 return __from_data(data, "platform_info_v2_dtype", platform_info_v2_dtype, PlatformInfo_v2)
5693 @staticmethod
5694 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
5695 """Create an PlatformInfo_v2 instance wrapping the given pointer.
5697 Args:
5698 ptr (intptr_t): pointer address as Python :class:`int` to the data.
5699 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
5700 readonly (bool): whether the data is read-only (to the user). default is `False`.
5701 """
5702 if ptr == 0:
5703 raise ValueError("ptr must not be null (0)")
5704 cdef PlatformInfo_v2 obj = PlatformInfo_v2.__new__(PlatformInfo_v2)
5705 if owner is None:
5706 obj._ptr = <nvmlPlatformInfo_v2_t *>malloc(sizeof(nvmlPlatformInfo_v2_t))
5707 if obj._ptr == NULL:
5708 raise MemoryError("Error allocating PlatformInfo_v2")
5709 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPlatformInfo_v2_t))
5710 obj._owner = None
5711 obj._owned = True
5712 else:
5713 obj._ptr = <nvmlPlatformInfo_v2_t *>ptr
5714 obj._owner = owner
5715 obj._owned = False
5716 obj._readonly = readonly
5717 return obj
5720cdef _get__py_anon_pod1_dtype_offsets():
5721 cdef _anon_pod1 pod = _anon_pod1()
5722 return _numpy.dtype({
5723 'names': ['b_is_present', 'percentage', 'inc_threshold', 'dec_threshold'],
5724 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
5725 'offsets': [
5726 (<intptr_t>&(pod.bIsPresent)) - (<intptr_t>&pod),
5727 (<intptr_t>&(pod.percentage)) - (<intptr_t>&pod),
5728 (<intptr_t>&(pod.incThreshold)) - (<intptr_t>&pod),
5729 (<intptr_t>&(pod.decThreshold)) - (<intptr_t>&pod),
5730 ],
5731 'itemsize': sizeof(_anon_pod1),
5732 })
5734_py_anon_pod1_dtype = _get__py_anon_pod1_dtype_offsets()
5736cdef class _py_anon_pod1:
5737 """Empty-initialize an instance of `_anon_pod1`.
5740 .. seealso:: `_anon_pod1`
5741 """
5742 cdef:
5743 _anon_pod1 *_ptr
5744 object _owner
5745 bint _owned
5746 bint _readonly
5748 def __init__(self):
5749 self._ptr = <_anon_pod1 *>calloc(1, sizeof(_anon_pod1))
5750 if self._ptr == NULL:
5751 raise MemoryError("Error allocating _py_anon_pod1")
5752 self._owner = None
5753 self._owned = True
5754 self._readonly = False
5756 def __dealloc__(self):
5757 cdef _anon_pod1 *ptr
5758 if self._owned and self._ptr != NULL: 1f
5759 ptr = self._ptr
5760 self._ptr = NULL
5761 free(ptr)
5763 def __repr__(self):
5764 return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>"
5766 @property
5767 def ptr(self):
5768 """Get the pointer address to the data as Python :class:`int`."""
5769 return <intptr_t>(self._ptr) 1f
5771 cdef intptr_t _get_ptr(self):
5772 return <intptr_t>(self._ptr)
5774 def __int__(self):
5775 return <intptr_t>(self._ptr)
5777 def __eq__(self, other):
5778 cdef _py_anon_pod1 other_
5779 if not isinstance(other, _py_anon_pod1):
5780 return False
5781 other_ = other
5782 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(_anon_pod1)) == 0)
5784 def __setitem__(self, key, val):
5785 if key == 0 and isinstance(val, _numpy.ndarray):
5786 self._ptr = <_anon_pod1 *>malloc(sizeof(_anon_pod1))
5787 if self._ptr == NULL:
5788 raise MemoryError("Error allocating _py_anon_pod1")
5789 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(_anon_pod1))
5790 self._owner = None
5791 self._owned = True
5792 self._readonly = not val.flags.writeable
5793 else:
5794 setattr(self, key, val)
5796 @property
5797 def b_is_present(self):
5798 """int: """
5799 return self._ptr[0].bIsPresent
5801 @b_is_present.setter
5802 def b_is_present(self, val):
5803 if self._readonly:
5804 raise ValueError("This _py_anon_pod1 instance is read-only")
5805 self._ptr[0].bIsPresent = val
5807 @property
5808 def percentage(self):
5809 """int: """
5810 return self._ptr[0].percentage
5812 @percentage.setter
5813 def percentage(self, val):
5814 if self._readonly:
5815 raise ValueError("This _py_anon_pod1 instance is read-only")
5816 self._ptr[0].percentage = val
5818 @property
5819 def inc_threshold(self):
5820 """int: """
5821 return self._ptr[0].incThreshold
5823 @inc_threshold.setter
5824 def inc_threshold(self, val):
5825 if self._readonly:
5826 raise ValueError("This _py_anon_pod1 instance is read-only")
5827 self._ptr[0].incThreshold = val
5829 @property
5830 def dec_threshold(self):
5831 """int: """
5832 return self._ptr[0].decThreshold
5834 @dec_threshold.setter
5835 def dec_threshold(self, val):
5836 if self._readonly:
5837 raise ValueError("This _py_anon_pod1 instance is read-only")
5838 self._ptr[0].decThreshold = val
5840 @staticmethod
5841 def from_data(data):
5842 """Create an _py_anon_pod1 instance wrapping the given NumPy array.
5844 Args:
5845 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod1_dtype` holding the data.
5846 """
5847 return __from_data(data, "_py_anon_pod1_dtype", _py_anon_pod1_dtype, _py_anon_pod1)
5849 @staticmethod
5850 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
5851 """Create an _py_anon_pod1 instance wrapping the given pointer.
5853 Args:
5854 ptr (intptr_t): pointer address as Python :class:`int` to the data.
5855 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
5856 readonly (bool): whether the data is read-only (to the user). default is `False`.
5857 """
5858 if ptr == 0: 1f
5859 raise ValueError("ptr must not be null (0)")
5860 cdef _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) 1f
5861 if owner is None: 1f
5862 obj._ptr = <_anon_pod1 *>malloc(sizeof(_anon_pod1))
5863 if obj._ptr == NULL:
5864 raise MemoryError("Error allocating _py_anon_pod1")
5865 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(_anon_pod1))
5866 obj._owner = None
5867 obj._owned = True
5868 else:
5869 obj._ptr = <_anon_pod1 *>ptr 1f
5870 obj._owner = owner 1f
5871 obj._owned = False 1f
5872 obj._readonly = readonly 1f
5873 return obj 1f
5876cdef _get_vgpu_placement_list_v2_dtype_offsets():
5877 cdef nvmlVgpuPlacementList_v2_t pod = nvmlVgpuPlacementList_v2_t()
5878 return _numpy.dtype({
5879 'names': ['version', 'placement_size', 'count', 'placement_ids', 'mode'],
5880 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.uint32],
5881 'offsets': [
5882 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
5883 (<intptr_t>&(pod.placementSize)) - (<intptr_t>&pod),
5884 (<intptr_t>&(pod.count)) - (<intptr_t>&pod),
5885 (<intptr_t>&(pod.placementIds)) - (<intptr_t>&pod),
5886 (<intptr_t>&(pod.mode)) - (<intptr_t>&pod),
5887 ],
5888 'itemsize': sizeof(nvmlVgpuPlacementList_v2_t),
5889 })
5891vgpu_placement_list_v2_dtype = _get_vgpu_placement_list_v2_dtype_offsets()
5893cdef class VgpuPlacementList_v2:
5894 """Empty-initialize an instance of `nvmlVgpuPlacementList_v2_t`.
5897 .. seealso:: `nvmlVgpuPlacementList_v2_t`
5898 """
5899 cdef:
5900 nvmlVgpuPlacementList_v2_t *_ptr
5901 object _owner
5902 bint _owned
5903 bint _readonly
5904 dict _refs
5906 def __init__(self):
5907 self._ptr = <nvmlVgpuPlacementList_v2_t *>calloc(1, sizeof(nvmlVgpuPlacementList_v2_t))
5908 if self._ptr == NULL:
5909 raise MemoryError("Error allocating VgpuPlacementList_v2")
5910 self._owner = None
5911 self._owned = True
5912 self._readonly = False
5913 self._refs = {}
5915 def __dealloc__(self):
5916 cdef nvmlVgpuPlacementList_v2_t *ptr
5917 if self._owned and self._ptr != NULL:
5918 ptr = self._ptr
5919 self._ptr = NULL
5920 free(ptr)
5922 def __repr__(self):
5923 return f"<{__name__}.VgpuPlacementList_v2 object at {hex(id(self))}>"
5925 @property
5926 def ptr(self):
5927 """Get the pointer address to the data as Python :class:`int`."""
5928 return <intptr_t>(self._ptr)
5930 cdef intptr_t _get_ptr(self):
5931 return <intptr_t>(self._ptr)
5933 def __int__(self):
5934 return <intptr_t>(self._ptr)
5936 def __eq__(self, other):
5937 cdef VgpuPlacementList_v2 other_
5938 if not isinstance(other, VgpuPlacementList_v2):
5939 return False
5940 other_ = other
5941 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuPlacementList_v2_t)) == 0)
5943 def __setitem__(self, key, val):
5944 if key == 0 and isinstance(val, _numpy.ndarray):
5945 self._ptr = <nvmlVgpuPlacementList_v2_t *>malloc(sizeof(nvmlVgpuPlacementList_v2_t))
5946 if self._ptr == NULL:
5947 raise MemoryError("Error allocating VgpuPlacementList_v2")
5948 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuPlacementList_v2_t))
5949 self._owner = None
5950 self._owned = True
5951 self._readonly = not val.flags.writeable
5952 else:
5953 setattr(self, key, val)
5955 @property
5956 def version(self):
5957 """int: IN: The version number of this struct."""
5958 return self._ptr[0].version
5960 @version.setter
5961 def version(self, val):
5962 if self._readonly:
5963 raise ValueError("This VgpuPlacementList_v2 instance is read-only")
5964 self._ptr[0].version = val
5966 @property
5967 def placement_size(self):
5968 """int: OUT: The number of slots occupied by the vGPU type."""
5969 return self._ptr[0].placementSize
5971 @placement_size.setter
5972 def placement_size(self, val):
5973 if self._readonly:
5974 raise ValueError("This VgpuPlacementList_v2 instance is read-only")
5975 self._ptr[0].placementSize = val
5977 @property
5978 def placement_ids(self):
5979 """int: IN/OUT: Placement IDs for the vGPU type."""
5980 if self._ptr[0].placementIds == NULL:
5981 return []
5982 cdef view.array arr = view.array(shape=(self._ptr[0].count,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False)
5983 arr.data = <char *>(self._ptr[0].placementIds)
5984 return _numpy.asarray(arr)
5986 @placement_ids.setter
5987 def placement_ids(self, val):
5988 if self._readonly:
5989 raise ValueError("This VgpuPlacementList_v2 instance is read-only")
5990 cdef view.array arr = view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c")
5991 arr[:] = _numpy.asarray(val, dtype=_numpy.uint32)
5992 self._ptr[0].placementIds = <unsigned int*><intptr_t>(arr.data)
5993 self._ptr[0].count = len(val)
5994 self._refs["placement_ids"] = arr
5996 @property
5997 def mode(self):
5998 """int: IN: The vGPU mode. Either NVML_VGPU_PGPU_HETEROGENEOUS_MODE or NVML_VGPU_PGPU_HOMOGENEOUS_MODE."""
5999 return self._ptr[0].mode
6001 @mode.setter
6002 def mode(self, val):
6003 if self._readonly:
6004 raise ValueError("This VgpuPlacementList_v2 instance is read-only")
6005 self._ptr[0].mode = val
6007 @staticmethod
6008 def from_data(data):
6009 """Create an VgpuPlacementList_v2 instance wrapping the given NumPy array.
6011 Args:
6012 data (_numpy.ndarray): a single-element array of dtype `vgpu_placement_list_v2_dtype` holding the data.
6013 """
6014 return __from_data(data, "vgpu_placement_list_v2_dtype", vgpu_placement_list_v2_dtype, VgpuPlacementList_v2)
6016 @staticmethod
6017 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
6018 """Create an VgpuPlacementList_v2 instance wrapping the given pointer.
6020 Args:
6021 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6022 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
6023 readonly (bool): whether the data is read-only (to the user). default is `False`.
6024 """
6025 if ptr == 0:
6026 raise ValueError("ptr must not be null (0)")
6027 cdef VgpuPlacementList_v2 obj = VgpuPlacementList_v2.__new__(VgpuPlacementList_v2)
6028 if owner is None:
6029 obj._ptr = <nvmlVgpuPlacementList_v2_t *>malloc(sizeof(nvmlVgpuPlacementList_v2_t))
6030 if obj._ptr == NULL:
6031 raise MemoryError("Error allocating VgpuPlacementList_v2")
6032 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuPlacementList_v2_t))
6033 obj._owner = None
6034 obj._owned = True
6035 else:
6036 obj._ptr = <nvmlVgpuPlacementList_v2_t *>ptr
6037 obj._owner = owner
6038 obj._owned = False
6039 obj._readonly = readonly
6040 obj._refs = {}
6041 return obj
6044cdef _get_vgpu_type_bar1info_v1_dtype_offsets():
6045 cdef nvmlVgpuTypeBar1Info_v1_t pod = nvmlVgpuTypeBar1Info_v1_t()
6046 return _numpy.dtype({
6047 'names': ['version', 'bar1size'],
6048 'formats': [_numpy.uint32, _numpy.uint64],
6049 'offsets': [
6050 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
6051 (<intptr_t>&(pod.bar1Size)) - (<intptr_t>&pod),
6052 ],
6053 'itemsize': sizeof(nvmlVgpuTypeBar1Info_v1_t),
6054 })
6056vgpu_type_bar1info_v1_dtype = _get_vgpu_type_bar1info_v1_dtype_offsets()
6058cdef class VgpuTypeBar1Info_v1:
6059 """Empty-initialize an instance of `nvmlVgpuTypeBar1Info_v1_t`.
6062 .. seealso:: `nvmlVgpuTypeBar1Info_v1_t`
6063 """
6064 cdef:
6065 nvmlVgpuTypeBar1Info_v1_t *_ptr
6066 object _owner
6067 bint _owned
6068 bint _readonly
6070 def __init__(self):
6071 self._ptr = <nvmlVgpuTypeBar1Info_v1_t *>calloc(1, sizeof(nvmlVgpuTypeBar1Info_v1_t))
6072 if self._ptr == NULL:
6073 raise MemoryError("Error allocating VgpuTypeBar1Info_v1")
6074 self._owner = None
6075 self._owned = True
6076 self._readonly = False
6078 def __dealloc__(self):
6079 cdef nvmlVgpuTypeBar1Info_v1_t *ptr
6080 if self._owned and self._ptr != NULL:
6081 ptr = self._ptr
6082 self._ptr = NULL
6083 free(ptr)
6085 def __repr__(self):
6086 return f"<{__name__}.VgpuTypeBar1Info_v1 object at {hex(id(self))}>"
6088 @property
6089 def ptr(self):
6090 """Get the pointer address to the data as Python :class:`int`."""
6091 return <intptr_t>(self._ptr)
6093 cdef intptr_t _get_ptr(self):
6094 return <intptr_t>(self._ptr)
6096 def __int__(self):
6097 return <intptr_t>(self._ptr)
6099 def __eq__(self, other):
6100 cdef VgpuTypeBar1Info_v1 other_
6101 if not isinstance(other, VgpuTypeBar1Info_v1):
6102 return False
6103 other_ = other
6104 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuTypeBar1Info_v1_t)) == 0)
6106 def __setitem__(self, key, val):
6107 if key == 0 and isinstance(val, _numpy.ndarray):
6108 self._ptr = <nvmlVgpuTypeBar1Info_v1_t *>malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t))
6109 if self._ptr == NULL:
6110 raise MemoryError("Error allocating VgpuTypeBar1Info_v1")
6111 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuTypeBar1Info_v1_t))
6112 self._owner = None
6113 self._owned = True
6114 self._readonly = not val.flags.writeable
6115 else:
6116 setattr(self, key, val)
6118 @property
6119 def version(self):
6120 """int: The version number of this struct."""
6121 return self._ptr[0].version
6123 @version.setter
6124 def version(self, val):
6125 if self._readonly:
6126 raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only")
6127 self._ptr[0].version = val
6129 @property
6130 def bar1size(self):
6131 """int: BAR1 size in megabytes."""
6132 return self._ptr[0].bar1Size
6134 @bar1size.setter
6135 def bar1size(self, val):
6136 if self._readonly:
6137 raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only")
6138 self._ptr[0].bar1Size = val
6140 @staticmethod
6141 def from_data(data):
6142 """Create an VgpuTypeBar1Info_v1 instance wrapping the given NumPy array.
6144 Args:
6145 data (_numpy.ndarray): a single-element array of dtype `vgpu_type_bar1info_v1_dtype` holding the data.
6146 """
6147 return __from_data(data, "vgpu_type_bar1info_v1_dtype", vgpu_type_bar1info_v1_dtype, VgpuTypeBar1Info_v1)
6149 @staticmethod
6150 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
6151 """Create an VgpuTypeBar1Info_v1 instance wrapping the given pointer.
6153 Args:
6154 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6155 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
6156 readonly (bool): whether the data is read-only (to the user). default is `False`.
6157 """
6158 if ptr == 0:
6159 raise ValueError("ptr must not be null (0)")
6160 cdef VgpuTypeBar1Info_v1 obj = VgpuTypeBar1Info_v1.__new__(VgpuTypeBar1Info_v1)
6161 if owner is None:
6162 obj._ptr = <nvmlVgpuTypeBar1Info_v1_t *>malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t))
6163 if obj._ptr == NULL:
6164 raise MemoryError("Error allocating VgpuTypeBar1Info_v1")
6165 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t))
6166 obj._owner = None
6167 obj._owned = True
6168 else:
6169 obj._ptr = <nvmlVgpuTypeBar1Info_v1_t *>ptr
6170 obj._owner = owner
6171 obj._owned = False
6172 obj._readonly = readonly
6173 return obj
6176cdef _get_vgpu_process_utilization_info_v1_dtype_offsets():
6177 cdef nvmlVgpuProcessUtilizationInfo_v1_t pod = nvmlVgpuProcessUtilizationInfo_v1_t()
6178 return _numpy.dtype({
6179 'names': ['process_name', 'time_stamp', 'vgpu_instance', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'],
6180 'formats': [(_numpy.int8, 64), _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
6181 'offsets': [
6182 (<intptr_t>&(pod.processName)) - (<intptr_t>&pod),
6183 (<intptr_t>&(pod.timeStamp)) - (<intptr_t>&pod),
6184 (<intptr_t>&(pod.vgpuInstance)) - (<intptr_t>&pod),
6185 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
6186 (<intptr_t>&(pod.smUtil)) - (<intptr_t>&pod),
6187 (<intptr_t>&(pod.memUtil)) - (<intptr_t>&pod),
6188 (<intptr_t>&(pod.encUtil)) - (<intptr_t>&pod),
6189 (<intptr_t>&(pod.decUtil)) - (<intptr_t>&pod),
6190 (<intptr_t>&(pod.jpgUtil)) - (<intptr_t>&pod),
6191 (<intptr_t>&(pod.ofaUtil)) - (<intptr_t>&pod),
6192 ],
6193 'itemsize': sizeof(nvmlVgpuProcessUtilizationInfo_v1_t),
6194 })
6196vgpu_process_utilization_info_v1_dtype = _get_vgpu_process_utilization_info_v1_dtype_offsets()
6198cdef class VgpuProcessUtilizationInfo_v1:
6199 """Empty-initialize an array of `nvmlVgpuProcessUtilizationInfo_v1_t`.
6201 The resulting object is of length `size` and of dtype `vgpu_process_utilization_info_v1_dtype`.
6202 If default-constructed, the instance represents a single struct.
6204 Args:
6205 size (int): number of structs, default=1.
6208 .. seealso:: `nvmlVgpuProcessUtilizationInfo_v1_t`
6209 """
6210 cdef:
6211 readonly object _data
6215 def __init__(self, size=1):
6216 arr = _numpy.empty(size, dtype=vgpu_process_utilization_info_v1_dtype)
6217 self._data = arr.view(_numpy.recarray)
6218 assert self._data.itemsize == sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), \
6219 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) }"
6221 def __repr__(self):
6222 if self._data.size > 1:
6223 return f"<{__name__}.VgpuProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>"
6224 else:
6225 return f"<{__name__}.VgpuProcessUtilizationInfo_v1 object at {hex(id(self))}>"
6227 @property
6228 def ptr(self):
6229 """Get the pointer address to the data as Python :class:`int`."""
6230 return self._data.ctypes.data
6232 cdef intptr_t _get_ptr(self):
6233 return self._data.ctypes.data
6235 def __int__(self):
6236 if self._data.size > 1:
6237 raise TypeError("int() argument must be a bytes-like object of size 1. "
6238 "To get the pointer address of an array, use .ptr")
6239 return self._data.ctypes.data
6241 def __len__(self):
6242 return self._data.size
6244 def __eq__(self, other):
6245 cdef object self_data = self._data
6246 if (not isinstance(other, VgpuProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
6247 return False
6248 return bool((self_data == other._data).all())
6250 @property
6251 def process_name(self):
6252 """~_numpy.int8: (array of length 64).Name of process running within the vGPU VM."""
6253 return self._data.process_name
6255 @process_name.setter
6256 def process_name(self, val):
6257 self._data.process_name = val
6259 @property
6260 def time_stamp(self):
6261 """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds."""
6262 if self._data.size == 1:
6263 return int(self._data.time_stamp[0])
6264 return self._data.time_stamp
6266 @time_stamp.setter
6267 def time_stamp(self, val):
6268 self._data.time_stamp = val
6270 @property
6271 def vgpu_instance(self):
6272 """Union[~_numpy.uint32, int]: vGPU Instance"""
6273 if self._data.size == 1:
6274 return int(self._data.vgpu_instance[0])
6275 return self._data.vgpu_instance
6277 @vgpu_instance.setter
6278 def vgpu_instance(self, val):
6279 self._data.vgpu_instance = val
6281 @property
6282 def pid(self):
6283 """Union[~_numpy.uint32, int]: PID of process running within the vGPU VM."""
6284 if self._data.size == 1:
6285 return int(self._data.pid[0])
6286 return self._data.pid
6288 @pid.setter
6289 def pid(self, val):
6290 self._data.pid = val
6292 @property
6293 def sm_util(self):
6294 """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value."""
6295 if self._data.size == 1:
6296 return int(self._data.sm_util[0])
6297 return self._data.sm_util
6299 @sm_util.setter
6300 def sm_util(self, val):
6301 self._data.sm_util = val
6303 @property
6304 def mem_util(self):
6305 """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value."""
6306 if self._data.size == 1:
6307 return int(self._data.mem_util[0])
6308 return self._data.mem_util
6310 @mem_util.setter
6311 def mem_util(self, val):
6312 self._data.mem_util = val
6314 @property
6315 def enc_util(self):
6316 """Union[~_numpy.uint32, int]: Encoder Util Value."""
6317 if self._data.size == 1:
6318 return int(self._data.enc_util[0])
6319 return self._data.enc_util
6321 @enc_util.setter
6322 def enc_util(self, val):
6323 self._data.enc_util = val
6325 @property
6326 def dec_util(self):
6327 """Union[~_numpy.uint32, int]: Decoder Util Value."""
6328 if self._data.size == 1:
6329 return int(self._data.dec_util[0])
6330 return self._data.dec_util
6332 @dec_util.setter
6333 def dec_util(self, val):
6334 self._data.dec_util = val
6336 @property
6337 def jpg_util(self):
6338 """Union[~_numpy.uint32, int]: Jpeg Util Value."""
6339 if self._data.size == 1:
6340 return int(self._data.jpg_util[0])
6341 return self._data.jpg_util
6343 @jpg_util.setter
6344 def jpg_util(self, val):
6345 self._data.jpg_util = val
6347 @property
6348 def ofa_util(self):
6349 """Union[~_numpy.uint32, int]: Ofa Util Value."""
6350 if self._data.size == 1:
6351 return int(self._data.ofa_util[0])
6352 return self._data.ofa_util
6354 @ofa_util.setter
6355 def ofa_util(self, val):
6356 self._data.ofa_util = val
6358 def __getitem__(self, key):
6359 cdef ssize_t key_
6360 cdef ssize_t size
6361 if isinstance(key, int):
6362 key_ = key
6363 size = self._data.size
6364 if key_ >= size or key_ <= -(size+1):
6365 raise IndexError("index is out of bounds")
6366 if key_ < 0:
6367 key_ += size
6368 return VgpuProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1])
6369 out = self._data[key]
6370 if isinstance(out, _numpy.recarray) and out.dtype == vgpu_process_utilization_info_v1_dtype:
6371 return VgpuProcessUtilizationInfo_v1.from_data(out)
6372 return out
6374 def __setitem__(self, key, val):
6375 self._data[key] = val
6377 @staticmethod
6378 def from_data(data):
6379 """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given NumPy array.
6381 Args:
6382 data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_info_v1_dtype` holding the data.
6383 """
6384 cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1)
6385 if not isinstance(data, _numpy.ndarray):
6386 raise TypeError("data argument must be a NumPy ndarray")
6387 if data.ndim != 1:
6388 raise ValueError("data array must be 1D")
6389 if data.dtype != vgpu_process_utilization_info_v1_dtype:
6390 raise ValueError("data array must be of dtype vgpu_process_utilization_info_v1_dtype")
6391 obj._data = data.view(_numpy.recarray)
6393 return obj
6395 @staticmethod
6396 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
6397 """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given pointer.
6399 Args:
6400 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6401 size (int): number of structs, default=1.
6402 readonly (bool): whether the data is read-only (to the user). default is `False`.
6403 """
6404 if ptr == 0:
6405 raise ValueError("ptr must not be null (0)")
6406 cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1)
6407 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
6408 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
6409 <char*>ptr, sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) * size, flag)
6410 data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_info_v1_dtype)
6411 obj._data = data.view(_numpy.recarray)
6413 return obj
6416cdef _get__py_anon_pod2_dtype_offsets():
6417 cdef _anon_pod2 pod = _anon_pod2()
6418 return _numpy.dtype({
6419 'names': ['avg_factor', 'timeslice'],
6420 'formats': [_numpy.uint32, _numpy.uint32],
6421 'offsets': [
6422 (<intptr_t>&(pod.avgFactor)) - (<intptr_t>&pod),
6423 (<intptr_t>&(pod.timeslice)) - (<intptr_t>&pod),
6424 ],
6425 'itemsize': sizeof(_anon_pod2),
6426 })
6428_py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets()
6430cdef class _py_anon_pod2:
6431 """Empty-initialize an instance of `_anon_pod2`.
6434 .. seealso:: `_anon_pod2`
6435 """
6436 cdef:
6437 _anon_pod2 *_ptr
6438 object _owner
6439 bint _owned
6440 bint _readonly
6442 def __init__(self):
6443 self._ptr = <_anon_pod2 *>calloc(1, sizeof(_anon_pod2))
6444 if self._ptr == NULL:
6445 raise MemoryError("Error allocating _py_anon_pod2")
6446 self._owner = None
6447 self._owned = True
6448 self._readonly = False
6450 def __dealloc__(self):
6451 cdef _anon_pod2 *ptr
6452 if self._owned and self._ptr != NULL:
6453 ptr = self._ptr
6454 self._ptr = NULL
6455 free(ptr)
6457 def __repr__(self):
6458 return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>"
6460 @property
6461 def ptr(self):
6462 """Get the pointer address to the data as Python :class:`int`."""
6463 return <intptr_t>(self._ptr)
6465 cdef intptr_t _get_ptr(self):
6466 return <intptr_t>(self._ptr)
6468 def __int__(self):
6469 return <intptr_t>(self._ptr)
6471 def __eq__(self, other):
6472 cdef _py_anon_pod2 other_
6473 if not isinstance(other, _py_anon_pod2):
6474 return False
6475 other_ = other
6476 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(_anon_pod2)) == 0)
6478 def __setitem__(self, key, val):
6479 if key == 0 and isinstance(val, _numpy.ndarray):
6480 self._ptr = <_anon_pod2 *>malloc(sizeof(_anon_pod2))
6481 if self._ptr == NULL:
6482 raise MemoryError("Error allocating _py_anon_pod2")
6483 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(_anon_pod2))
6484 self._owner = None
6485 self._owned = True
6486 self._readonly = not val.flags.writeable
6487 else:
6488 setattr(self, key, val)
6490 @property
6491 def avg_factor(self):
6492 """int: """
6493 return self._ptr[0].avgFactor
6495 @avg_factor.setter
6496 def avg_factor(self, val):
6497 if self._readonly:
6498 raise ValueError("This _py_anon_pod2 instance is read-only")
6499 self._ptr[0].avgFactor = val
6501 @property
6502 def timeslice(self):
6503 """int: """
6504 return self._ptr[0].timeslice
6506 @timeslice.setter
6507 def timeslice(self, val):
6508 if self._readonly:
6509 raise ValueError("This _py_anon_pod2 instance is read-only")
6510 self._ptr[0].timeslice = val
6512 @staticmethod
6513 def from_data(data):
6514 """Create an _py_anon_pod2 instance wrapping the given NumPy array.
6516 Args:
6517 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod2_dtype` holding the data.
6518 """
6519 return __from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2)
6521 @staticmethod
6522 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
6523 """Create an _py_anon_pod2 instance wrapping the given pointer.
6525 Args:
6526 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6527 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
6528 readonly (bool): whether the data is read-only (to the user). default is `False`.
6529 """
6530 if ptr == 0:
6531 raise ValueError("ptr must not be null (0)")
6532 cdef _py_anon_pod2 obj = _py_anon_pod2.__new__(_py_anon_pod2)
6533 if owner is None:
6534 obj._ptr = <_anon_pod2 *>malloc(sizeof(_anon_pod2))
6535 if obj._ptr == NULL:
6536 raise MemoryError("Error allocating _py_anon_pod2")
6537 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(_anon_pod2))
6538 obj._owner = None
6539 obj._owned = True
6540 else:
6541 obj._ptr = <_anon_pod2 *>ptr
6542 obj._owner = owner
6543 obj._owned = False
6544 obj._readonly = readonly
6545 return obj
6548cdef _get__py_anon_pod3_dtype_offsets():
6549 cdef _anon_pod3 pod = _anon_pod3()
6550 return _numpy.dtype({
6551 'names': ['timeslice'],
6552 'formats': [_numpy.uint32],
6553 'offsets': [
6554 (<intptr_t>&(pod.timeslice)) - (<intptr_t>&pod),
6555 ],
6556 'itemsize': sizeof(_anon_pod3),
6557 })
6559_py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets()
6561cdef class _py_anon_pod3:
6562 """Empty-initialize an instance of `_anon_pod3`.
6565 .. seealso:: `_anon_pod3`
6566 """
6567 cdef:
6568 _anon_pod3 *_ptr
6569 object _owner
6570 bint _owned
6571 bint _readonly
6573 def __init__(self):
6574 self._ptr = <_anon_pod3 *>calloc(1, sizeof(_anon_pod3))
6575 if self._ptr == NULL:
6576 raise MemoryError("Error allocating _py_anon_pod3")
6577 self._owner = None
6578 self._owned = True
6579 self._readonly = False
6581 def __dealloc__(self):
6582 cdef _anon_pod3 *ptr
6583 if self._owned and self._ptr != NULL:
6584 ptr = self._ptr
6585 self._ptr = NULL
6586 free(ptr)
6588 def __repr__(self):
6589 return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>"
6591 @property
6592 def ptr(self):
6593 """Get the pointer address to the data as Python :class:`int`."""
6594 return <intptr_t>(self._ptr)
6596 cdef intptr_t _get_ptr(self):
6597 return <intptr_t>(self._ptr)
6599 def __int__(self):
6600 return <intptr_t>(self._ptr)
6602 def __eq__(self, other):
6603 cdef _py_anon_pod3 other_
6604 if not isinstance(other, _py_anon_pod3):
6605 return False
6606 other_ = other
6607 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(_anon_pod3)) == 0)
6609 def __setitem__(self, key, val):
6610 if key == 0 and isinstance(val, _numpy.ndarray):
6611 self._ptr = <_anon_pod3 *>malloc(sizeof(_anon_pod3))
6612 if self._ptr == NULL:
6613 raise MemoryError("Error allocating _py_anon_pod3")
6614 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(_anon_pod3))
6615 self._owner = None
6616 self._owned = True
6617 self._readonly = not val.flags.writeable
6618 else:
6619 setattr(self, key, val)
6621 @property
6622 def timeslice(self):
6623 """int: """
6624 return self._ptr[0].timeslice
6626 @timeslice.setter
6627 def timeslice(self, val):
6628 if self._readonly:
6629 raise ValueError("This _py_anon_pod3 instance is read-only")
6630 self._ptr[0].timeslice = val
6632 @staticmethod
6633 def from_data(data):
6634 """Create an _py_anon_pod3 instance wrapping the given NumPy array.
6636 Args:
6637 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod3_dtype` holding the data.
6638 """
6639 return __from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3)
6641 @staticmethod
6642 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
6643 """Create an _py_anon_pod3 instance wrapping the given pointer.
6645 Args:
6646 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6647 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
6648 readonly (bool): whether the data is read-only (to the user). default is `False`.
6649 """
6650 if ptr == 0:
6651 raise ValueError("ptr must not be null (0)")
6652 cdef _py_anon_pod3 obj = _py_anon_pod3.__new__(_py_anon_pod3)
6653 if owner is None:
6654 obj._ptr = <_anon_pod3 *>malloc(sizeof(_anon_pod3))
6655 if obj._ptr == NULL:
6656 raise MemoryError("Error allocating _py_anon_pod3")
6657 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(_anon_pod3))
6658 obj._owner = None
6659 obj._owned = True
6660 else:
6661 obj._ptr = <_anon_pod3 *>ptr
6662 obj._owner = owner
6663 obj._owned = False
6664 obj._readonly = readonly
6665 return obj
6668cdef _get_vgpu_scheduler_log_entry_dtype_offsets():
6669 cdef nvmlVgpuSchedulerLogEntry_t pod = nvmlVgpuSchedulerLogEntry_t()
6670 return _numpy.dtype({
6671 'names': ['timestamp', 'time_run_total', 'time_run', 'sw_runlist_id', 'target_time_slice', 'cumulative_preemption_time'],
6672 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint64, _numpy.uint64],
6673 'offsets': [
6674 (<intptr_t>&(pod.timestamp)) - (<intptr_t>&pod),
6675 (<intptr_t>&(pod.timeRunTotal)) - (<intptr_t>&pod),
6676 (<intptr_t>&(pod.timeRun)) - (<intptr_t>&pod),
6677 (<intptr_t>&(pod.swRunlistId)) - (<intptr_t>&pod),
6678 (<intptr_t>&(pod.targetTimeSlice)) - (<intptr_t>&pod),
6679 (<intptr_t>&(pod.cumulativePreemptionTime)) - (<intptr_t>&pod),
6680 ],
6681 'itemsize': sizeof(nvmlVgpuSchedulerLogEntry_t),
6682 })
6684vgpu_scheduler_log_entry_dtype = _get_vgpu_scheduler_log_entry_dtype_offsets()
6686cdef class VgpuSchedulerLogEntry:
6687 """Empty-initialize an array of `nvmlVgpuSchedulerLogEntry_t`.
6689 The resulting object is of length `size` and of dtype `vgpu_scheduler_log_entry_dtype`.
6690 If default-constructed, the instance represents a single struct.
6692 Args:
6693 size (int): number of structs, default=1.
6696 .. seealso:: `nvmlVgpuSchedulerLogEntry_t`
6697 """
6698 cdef:
6699 readonly object _data
6703 def __init__(self, size=1):
6704 arr = _numpy.empty(size, dtype=vgpu_scheduler_log_entry_dtype)
6705 self._data = arr.view(_numpy.recarray)
6706 assert self._data.itemsize == sizeof(nvmlVgpuSchedulerLogEntry_t), \
6707 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuSchedulerLogEntry_t) }"
6709 def __repr__(self):
6710 if self._data.size > 1:
6711 return f"<{__name__}.VgpuSchedulerLogEntry_Array_{self._data.size} object at {hex(id(self))}>"
6712 else:
6713 return f"<{__name__}.VgpuSchedulerLogEntry object at {hex(id(self))}>"
6715 @property
6716 def ptr(self):
6717 """Get the pointer address to the data as Python :class:`int`."""
6718 return self._data.ctypes.data
6720 cdef intptr_t _get_ptr(self):
6721 return self._data.ctypes.data
6723 def __int__(self):
6724 if self._data.size > 1:
6725 raise TypeError("int() argument must be a bytes-like object of size 1. "
6726 "To get the pointer address of an array, use .ptr")
6727 return self._data.ctypes.data
6729 def __len__(self):
6730 return self._data.size
6732 def __eq__(self, other):
6733 cdef object self_data = self._data
6734 if (not isinstance(other, VgpuSchedulerLogEntry)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
6735 return False
6736 return bool((self_data == other._data).all())
6738 @property
6739 def timestamp(self):
6740 """Union[~_numpy.uint64, int]: """
6741 if self._data.size == 1:
6742 return int(self._data.timestamp[0])
6743 return self._data.timestamp
6745 @timestamp.setter
6746 def timestamp(self, val):
6747 self._data.timestamp = val
6749 @property
6750 def time_run_total(self):
6751 """Union[~_numpy.uint64, int]: """
6752 if self._data.size == 1:
6753 return int(self._data.time_run_total[0])
6754 return self._data.time_run_total
6756 @time_run_total.setter
6757 def time_run_total(self, val):
6758 self._data.time_run_total = val
6760 @property
6761 def time_run(self):
6762 """Union[~_numpy.uint64, int]: """
6763 if self._data.size == 1:
6764 return int(self._data.time_run[0])
6765 return self._data.time_run
6767 @time_run.setter
6768 def time_run(self, val):
6769 self._data.time_run = val
6771 @property
6772 def sw_runlist_id(self):
6773 """Union[~_numpy.uint32, int]: """
6774 if self._data.size == 1:
6775 return int(self._data.sw_runlist_id[0])
6776 return self._data.sw_runlist_id
6778 @sw_runlist_id.setter
6779 def sw_runlist_id(self, val):
6780 self._data.sw_runlist_id = val
6782 @property
6783 def target_time_slice(self):
6784 """Union[~_numpy.uint64, int]: """
6785 if self._data.size == 1:
6786 return int(self._data.target_time_slice[0])
6787 return self._data.target_time_slice
6789 @target_time_slice.setter
6790 def target_time_slice(self, val):
6791 self._data.target_time_slice = val
6793 @property
6794 def cumulative_preemption_time(self):
6795 """Union[~_numpy.uint64, int]: """
6796 if self._data.size == 1:
6797 return int(self._data.cumulative_preemption_time[0])
6798 return self._data.cumulative_preemption_time
6800 @cumulative_preemption_time.setter
6801 def cumulative_preemption_time(self, val):
6802 self._data.cumulative_preemption_time = val
6804 def __getitem__(self, key):
6805 cdef ssize_t key_
6806 cdef ssize_t size
6807 if isinstance(key, int):
6808 key_ = key
6809 size = self._data.size
6810 if key_ >= size or key_ <= -(size+1):
6811 raise IndexError("index is out of bounds")
6812 if key_ < 0:
6813 key_ += size
6814 return VgpuSchedulerLogEntry.from_data(self._data[key_:key_+1])
6815 out = self._data[key]
6816 if isinstance(out, _numpy.recarray) and out.dtype == vgpu_scheduler_log_entry_dtype:
6817 return VgpuSchedulerLogEntry.from_data(out)
6818 return out
6820 def __setitem__(self, key, val):
6821 self._data[key] = val
6823 @staticmethod
6824 def from_data(data):
6825 """Create an VgpuSchedulerLogEntry instance wrapping the given NumPy array.
6827 Args:
6828 data (_numpy.ndarray): a 1D array of dtype `vgpu_scheduler_log_entry_dtype` holding the data.
6829 """
6830 cdef VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry)
6831 if not isinstance(data, _numpy.ndarray):
6832 raise TypeError("data argument must be a NumPy ndarray")
6833 if data.ndim != 1:
6834 raise ValueError("data array must be 1D")
6835 if data.dtype != vgpu_scheduler_log_entry_dtype:
6836 raise ValueError("data array must be of dtype vgpu_scheduler_log_entry_dtype")
6837 obj._data = data.view(_numpy.recarray)
6839 return obj
6841 @staticmethod
6842 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
6843 """Create an VgpuSchedulerLogEntry instance wrapping the given pointer.
6845 Args:
6846 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6847 size (int): number of structs, default=1.
6848 readonly (bool): whether the data is read-only (to the user). default is `False`.
6849 """
6850 if ptr == 0:
6851 raise ValueError("ptr must not be null (0)")
6852 cdef VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry)
6853 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
6854 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
6855 <char*>ptr, sizeof(nvmlVgpuSchedulerLogEntry_t) * size, flag)
6856 data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_scheduler_log_entry_dtype)
6857 obj._data = data.view(_numpy.recarray)
6859 return obj
6862cdef _get__py_anon_pod4_dtype_offsets():
6863 cdef _anon_pod4 pod = _anon_pod4()
6864 return _numpy.dtype({
6865 'names': ['avg_factor', 'frequency'],
6866 'formats': [_numpy.uint32, _numpy.uint32],
6867 'offsets': [
6868 (<intptr_t>&(pod.avgFactor)) - (<intptr_t>&pod),
6869 (<intptr_t>&(pod.frequency)) - (<intptr_t>&pod),
6870 ],
6871 'itemsize': sizeof(_anon_pod4),
6872 })
6874_py_anon_pod4_dtype = _get__py_anon_pod4_dtype_offsets()
6876cdef class _py_anon_pod4:
6877 """Empty-initialize an instance of `_anon_pod4`.
6880 .. seealso:: `_anon_pod4`
6881 """
6882 cdef:
6883 _anon_pod4 *_ptr
6884 object _owner
6885 bint _owned
6886 bint _readonly
6888 def __init__(self):
6889 self._ptr = <_anon_pod4 *>calloc(1, sizeof(_anon_pod4))
6890 if self._ptr == NULL:
6891 raise MemoryError("Error allocating _py_anon_pod4")
6892 self._owner = None
6893 self._owned = True
6894 self._readonly = False
6896 def __dealloc__(self):
6897 cdef _anon_pod4 *ptr
6898 if self._owned and self._ptr != NULL:
6899 ptr = self._ptr
6900 self._ptr = NULL
6901 free(ptr)
6903 def __repr__(self):
6904 return f"<{__name__}._py_anon_pod4 object at {hex(id(self))}>"
6906 @property
6907 def ptr(self):
6908 """Get the pointer address to the data as Python :class:`int`."""
6909 return <intptr_t>(self._ptr)
6911 cdef intptr_t _get_ptr(self):
6912 return <intptr_t>(self._ptr)
6914 def __int__(self):
6915 return <intptr_t>(self._ptr)
6917 def __eq__(self, other):
6918 cdef _py_anon_pod4 other_
6919 if not isinstance(other, _py_anon_pod4):
6920 return False
6921 other_ = other
6922 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(_anon_pod4)) == 0)
6924 def __setitem__(self, key, val):
6925 if key == 0 and isinstance(val, _numpy.ndarray):
6926 self._ptr = <_anon_pod4 *>malloc(sizeof(_anon_pod4))
6927 if self._ptr == NULL:
6928 raise MemoryError("Error allocating _py_anon_pod4")
6929 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(_anon_pod4))
6930 self._owner = None
6931 self._owned = True
6932 self._readonly = not val.flags.writeable
6933 else:
6934 setattr(self, key, val)
6936 @property
6937 def avg_factor(self):
6938 """int: """
6939 return self._ptr[0].avgFactor
6941 @avg_factor.setter
6942 def avg_factor(self, val):
6943 if self._readonly:
6944 raise ValueError("This _py_anon_pod4 instance is read-only")
6945 self._ptr[0].avgFactor = val
6947 @property
6948 def frequency(self):
6949 """int: """
6950 return self._ptr[0].frequency
6952 @frequency.setter
6953 def frequency(self, val):
6954 if self._readonly:
6955 raise ValueError("This _py_anon_pod4 instance is read-only")
6956 self._ptr[0].frequency = val
6958 @staticmethod
6959 def from_data(data):
6960 """Create an _py_anon_pod4 instance wrapping the given NumPy array.
6962 Args:
6963 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod4_dtype` holding the data.
6964 """
6965 return __from_data(data, "_py_anon_pod4_dtype", _py_anon_pod4_dtype, _py_anon_pod4)
6967 @staticmethod
6968 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
6969 """Create an _py_anon_pod4 instance wrapping the given pointer.
6971 Args:
6972 ptr (intptr_t): pointer address as Python :class:`int` to the data.
6973 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
6974 readonly (bool): whether the data is read-only (to the user). default is `False`.
6975 """
6976 if ptr == 0:
6977 raise ValueError("ptr must not be null (0)")
6978 cdef _py_anon_pod4 obj = _py_anon_pod4.__new__(_py_anon_pod4)
6979 if owner is None:
6980 obj._ptr = <_anon_pod4 *>malloc(sizeof(_anon_pod4))
6981 if obj._ptr == NULL:
6982 raise MemoryError("Error allocating _py_anon_pod4")
6983 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(_anon_pod4))
6984 obj._owner = None
6985 obj._owned = True
6986 else:
6987 obj._ptr = <_anon_pod4 *>ptr
6988 obj._owner = owner
6989 obj._owned = False
6990 obj._readonly = readonly
6991 return obj
6994cdef _get__py_anon_pod5_dtype_offsets():
6995 cdef _anon_pod5 pod = _anon_pod5()
6996 return _numpy.dtype({
6997 'names': ['timeslice'],
6998 'formats': [_numpy.uint32],
6999 'offsets': [
7000 (<intptr_t>&(pod.timeslice)) - (<intptr_t>&pod),
7001 ],
7002 'itemsize': sizeof(_anon_pod5),
7003 })
7005_py_anon_pod5_dtype = _get__py_anon_pod5_dtype_offsets()
7007cdef class _py_anon_pod5:
7008 """Empty-initialize an instance of `_anon_pod5`.
7011 .. seealso:: `_anon_pod5`
7012 """
7013 cdef:
7014 _anon_pod5 *_ptr
7015 object _owner
7016 bint _owned
7017 bint _readonly
7019 def __init__(self):
7020 self._ptr = <_anon_pod5 *>calloc(1, sizeof(_anon_pod5))
7021 if self._ptr == NULL:
7022 raise MemoryError("Error allocating _py_anon_pod5")
7023 self._owner = None
7024 self._owned = True
7025 self._readonly = False
7027 def __dealloc__(self):
7028 cdef _anon_pod5 *ptr
7029 if self._owned and self._ptr != NULL:
7030 ptr = self._ptr
7031 self._ptr = NULL
7032 free(ptr)
7034 def __repr__(self):
7035 return f"<{__name__}._py_anon_pod5 object at {hex(id(self))}>"
7037 @property
7038 def ptr(self):
7039 """Get the pointer address to the data as Python :class:`int`."""
7040 return <intptr_t>(self._ptr)
7042 cdef intptr_t _get_ptr(self):
7043 return <intptr_t>(self._ptr)
7045 def __int__(self):
7046 return <intptr_t>(self._ptr)
7048 def __eq__(self, other):
7049 cdef _py_anon_pod5 other_
7050 if not isinstance(other, _py_anon_pod5):
7051 return False
7052 other_ = other
7053 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(_anon_pod5)) == 0)
7055 def __setitem__(self, key, val):
7056 if key == 0 and isinstance(val, _numpy.ndarray):
7057 self._ptr = <_anon_pod5 *>malloc(sizeof(_anon_pod5))
7058 if self._ptr == NULL:
7059 raise MemoryError("Error allocating _py_anon_pod5")
7060 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(_anon_pod5))
7061 self._owner = None
7062 self._owned = True
7063 self._readonly = not val.flags.writeable
7064 else:
7065 setattr(self, key, val)
7067 @property
7068 def timeslice(self):
7069 """int: """
7070 return self._ptr[0].timeslice
7072 @timeslice.setter
7073 def timeslice(self, val):
7074 if self._readonly:
7075 raise ValueError("This _py_anon_pod5 instance is read-only")
7076 self._ptr[0].timeslice = val
7078 @staticmethod
7079 def from_data(data):
7080 """Create an _py_anon_pod5 instance wrapping the given NumPy array.
7082 Args:
7083 data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod5_dtype` holding the data.
7084 """
7085 return __from_data(data, "_py_anon_pod5_dtype", _py_anon_pod5_dtype, _py_anon_pod5)
7087 @staticmethod
7088 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
7089 """Create an _py_anon_pod5 instance wrapping the given pointer.
7091 Args:
7092 ptr (intptr_t): pointer address as Python :class:`int` to the data.
7093 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
7094 readonly (bool): whether the data is read-only (to the user). default is `False`.
7095 """
7096 if ptr == 0:
7097 raise ValueError("ptr must not be null (0)")
7098 cdef _py_anon_pod5 obj = _py_anon_pod5.__new__(_py_anon_pod5)
7099 if owner is None:
7100 obj._ptr = <_anon_pod5 *>malloc(sizeof(_anon_pod5))
7101 if obj._ptr == NULL:
7102 raise MemoryError("Error allocating _py_anon_pod5")
7103 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(_anon_pod5))
7104 obj._owner = None
7105 obj._owned = True
7106 else:
7107 obj._ptr = <_anon_pod5 *>ptr
7108 obj._owner = owner
7109 obj._owned = False
7110 obj._readonly = readonly
7111 return obj
7114cdef _get_vgpu_scheduler_capabilities_dtype_offsets():
7115 cdef nvmlVgpuSchedulerCapabilities_t pod = nvmlVgpuSchedulerCapabilities_t()
7116 return _numpy.dtype({
7117 'names': ['supported_schedulers', 'max_timeslice', 'min_timeslice', 'is_arr_mode_supported', 'max_frequency_for_arr', 'min_frequency_for_arr', 'max_avg_factor_for_arr', 'min_avg_factor_for_arr'],
7118 'formats': [(_numpy.uint32, 3), _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
7119 'offsets': [
7120 (<intptr_t>&(pod.supportedSchedulers)) - (<intptr_t>&pod),
7121 (<intptr_t>&(pod.maxTimeslice)) - (<intptr_t>&pod),
7122 (<intptr_t>&(pod.minTimeslice)) - (<intptr_t>&pod),
7123 (<intptr_t>&(pod.isArrModeSupported)) - (<intptr_t>&pod),
7124 (<intptr_t>&(pod.maxFrequencyForARR)) - (<intptr_t>&pod),
7125 (<intptr_t>&(pod.minFrequencyForARR)) - (<intptr_t>&pod),
7126 (<intptr_t>&(pod.maxAvgFactorForARR)) - (<intptr_t>&pod),
7127 (<intptr_t>&(pod.minAvgFactorForARR)) - (<intptr_t>&pod),
7128 ],
7129 'itemsize': sizeof(nvmlVgpuSchedulerCapabilities_t),
7130 })
7132vgpu_scheduler_capabilities_dtype = _get_vgpu_scheduler_capabilities_dtype_offsets()
7134cdef class VgpuSchedulerCapabilities:
7135 """Empty-initialize an instance of `nvmlVgpuSchedulerCapabilities_t`.
7138 .. seealso:: `nvmlVgpuSchedulerCapabilities_t`
7139 """
7140 cdef:
7141 nvmlVgpuSchedulerCapabilities_t *_ptr
7142 object _owner
7143 bint _owned
7144 bint _readonly
7146 def __init__(self):
7147 self._ptr = <nvmlVgpuSchedulerCapabilities_t *>calloc(1, sizeof(nvmlVgpuSchedulerCapabilities_t))
7148 if self._ptr == NULL:
7149 raise MemoryError("Error allocating VgpuSchedulerCapabilities")
7150 self._owner = None
7151 self._owned = True
7152 self._readonly = False
7154 def __dealloc__(self):
7155 cdef nvmlVgpuSchedulerCapabilities_t *ptr
7156 if self._owned and self._ptr != NULL:
7157 ptr = self._ptr
7158 self._ptr = NULL
7159 free(ptr)
7161 def __repr__(self):
7162 return f"<{__name__}.VgpuSchedulerCapabilities object at {hex(id(self))}>"
7164 @property
7165 def ptr(self):
7166 """Get the pointer address to the data as Python :class:`int`."""
7167 return <intptr_t>(self._ptr)
7169 cdef intptr_t _get_ptr(self):
7170 return <intptr_t>(self._ptr)
7172 def __int__(self):
7173 return <intptr_t>(self._ptr)
7175 def __eq__(self, other):
7176 cdef VgpuSchedulerCapabilities other_
7177 if not isinstance(other, VgpuSchedulerCapabilities):
7178 return False
7179 other_ = other
7180 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerCapabilities_t)) == 0)
7182 def __setitem__(self, key, val):
7183 if key == 0 and isinstance(val, _numpy.ndarray):
7184 self._ptr = <nvmlVgpuSchedulerCapabilities_t *>malloc(sizeof(nvmlVgpuSchedulerCapabilities_t))
7185 if self._ptr == NULL:
7186 raise MemoryError("Error allocating VgpuSchedulerCapabilities")
7187 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerCapabilities_t))
7188 self._owner = None
7189 self._owned = True
7190 self._readonly = not val.flags.writeable
7191 else:
7192 setattr(self, key, val)
7194 @property
7195 def supported_schedulers(self):
7196 """~_numpy.uint32: (array of length 3)."""
7197 cdef view.array arr = view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False)
7198 arr.data = <char *>(&(self._ptr[0].supportedSchedulers))
7199 return _numpy.asarray(arr)
7201 @supported_schedulers.setter
7202 def supported_schedulers(self, val):
7203 if self._readonly:
7204 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7205 if len(val) != 3:
7206 raise ValueError(f"Expected length { 3 } for field supported_schedulers, got {len(val)}")
7207 cdef view.array arr = view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c")
7208 arr[:] = _numpy.asarray(val, dtype=_numpy.uint32)
7209 memcpy(<void *>(&(self._ptr[0].supportedSchedulers)), <void *>(arr.data), sizeof(unsigned int) * len(val))
7211 @property
7212 def max_timeslice(self):
7213 """int: """
7214 return self._ptr[0].maxTimeslice
7216 @max_timeslice.setter
7217 def max_timeslice(self, val):
7218 if self._readonly:
7219 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7220 self._ptr[0].maxTimeslice = val
7222 @property
7223 def min_timeslice(self):
7224 """int: """
7225 return self._ptr[0].minTimeslice
7227 @min_timeslice.setter
7228 def min_timeslice(self, val):
7229 if self._readonly:
7230 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7231 self._ptr[0].minTimeslice = val
7233 @property
7234 def is_arr_mode_supported(self):
7235 """int: """
7236 return self._ptr[0].isArrModeSupported
7238 @is_arr_mode_supported.setter
7239 def is_arr_mode_supported(self, val):
7240 if self._readonly:
7241 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7242 self._ptr[0].isArrModeSupported = val
7244 @property
7245 def max_frequency_for_arr(self):
7246 """int: """
7247 return self._ptr[0].maxFrequencyForARR
7249 @max_frequency_for_arr.setter
7250 def max_frequency_for_arr(self, val):
7251 if self._readonly:
7252 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7253 self._ptr[0].maxFrequencyForARR = val
7255 @property
7256 def min_frequency_for_arr(self):
7257 """int: """
7258 return self._ptr[0].minFrequencyForARR
7260 @min_frequency_for_arr.setter
7261 def min_frequency_for_arr(self, val):
7262 if self._readonly:
7263 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7264 self._ptr[0].minFrequencyForARR = val
7266 @property
7267 def max_avg_factor_for_arr(self):
7268 """int: """
7269 return self._ptr[0].maxAvgFactorForARR
7271 @max_avg_factor_for_arr.setter
7272 def max_avg_factor_for_arr(self, val):
7273 if self._readonly:
7274 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7275 self._ptr[0].maxAvgFactorForARR = val
7277 @property
7278 def min_avg_factor_for_arr(self):
7279 """int: """
7280 return self._ptr[0].minAvgFactorForARR
7282 @min_avg_factor_for_arr.setter
7283 def min_avg_factor_for_arr(self, val):
7284 if self._readonly:
7285 raise ValueError("This VgpuSchedulerCapabilities instance is read-only")
7286 self._ptr[0].minAvgFactorForARR = val
7288 @staticmethod
7289 def from_data(data):
7290 """Create an VgpuSchedulerCapabilities instance wrapping the given NumPy array.
7292 Args:
7293 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_capabilities_dtype` holding the data.
7294 """
7295 return __from_data(data, "vgpu_scheduler_capabilities_dtype", vgpu_scheduler_capabilities_dtype, VgpuSchedulerCapabilities)
7297 @staticmethod
7298 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
7299 """Create an VgpuSchedulerCapabilities instance wrapping the given pointer.
7301 Args:
7302 ptr (intptr_t): pointer address as Python :class:`int` to the data.
7303 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
7304 readonly (bool): whether the data is read-only (to the user). default is `False`.
7305 """
7306 if ptr == 0:
7307 raise ValueError("ptr must not be null (0)")
7308 cdef VgpuSchedulerCapabilities obj = VgpuSchedulerCapabilities.__new__(VgpuSchedulerCapabilities)
7309 if owner is None:
7310 obj._ptr = <nvmlVgpuSchedulerCapabilities_t *>malloc(sizeof(nvmlVgpuSchedulerCapabilities_t))
7311 if obj._ptr == NULL:
7312 raise MemoryError("Error allocating VgpuSchedulerCapabilities")
7313 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerCapabilities_t))
7314 obj._owner = None
7315 obj._owned = True
7316 else:
7317 obj._ptr = <nvmlVgpuSchedulerCapabilities_t *>ptr
7318 obj._owner = owner
7319 obj._owned = False
7320 obj._readonly = readonly
7321 return obj
7324cdef _get_vgpu_license_expiry_dtype_offsets():
7325 cdef nvmlVgpuLicenseExpiry_t pod = nvmlVgpuLicenseExpiry_t()
7326 return _numpy.dtype({
7327 'names': ['year', 'month', 'day', 'hour', 'min_', 'sec', 'status'],
7328 'formats': [_numpy.uint32, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint8],
7329 'offsets': [
7330 (<intptr_t>&(pod.year)) - (<intptr_t>&pod),
7331 (<intptr_t>&(pod.month)) - (<intptr_t>&pod),
7332 (<intptr_t>&(pod.day)) - (<intptr_t>&pod),
7333 (<intptr_t>&(pod.hour)) - (<intptr_t>&pod),
7334 (<intptr_t>&(pod.min)) - (<intptr_t>&pod),
7335 (<intptr_t>&(pod.sec)) - (<intptr_t>&pod),
7336 (<intptr_t>&(pod.status)) - (<intptr_t>&pod),
7337 ],
7338 'itemsize': sizeof(nvmlVgpuLicenseExpiry_t),
7339 })
7341vgpu_license_expiry_dtype = _get_vgpu_license_expiry_dtype_offsets()
7343cdef class VgpuLicenseExpiry:
7344 """Empty-initialize an instance of `nvmlVgpuLicenseExpiry_t`.
7347 .. seealso:: `nvmlVgpuLicenseExpiry_t`
7348 """
7349 cdef:
7350 nvmlVgpuLicenseExpiry_t *_ptr
7351 object _owner
7352 bint _owned
7353 bint _readonly
7355 def __init__(self):
7356 self._ptr = <nvmlVgpuLicenseExpiry_t *>calloc(1, sizeof(nvmlVgpuLicenseExpiry_t))
7357 if self._ptr == NULL:
7358 raise MemoryError("Error allocating VgpuLicenseExpiry")
7359 self._owner = None
7360 self._owned = True
7361 self._readonly = False
7363 def __dealloc__(self):
7364 cdef nvmlVgpuLicenseExpiry_t *ptr
7365 if self._owned and self._ptr != NULL:
7366 ptr = self._ptr
7367 self._ptr = NULL
7368 free(ptr)
7370 def __repr__(self):
7371 return f"<{__name__}.VgpuLicenseExpiry object at {hex(id(self))}>"
7373 @property
7374 def ptr(self):
7375 """Get the pointer address to the data as Python :class:`int`."""
7376 return <intptr_t>(self._ptr)
7378 cdef intptr_t _get_ptr(self):
7379 return <intptr_t>(self._ptr)
7381 def __int__(self):
7382 return <intptr_t>(self._ptr)
7384 def __eq__(self, other):
7385 cdef VgpuLicenseExpiry other_
7386 if not isinstance(other, VgpuLicenseExpiry):
7387 return False
7388 other_ = other
7389 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuLicenseExpiry_t)) == 0)
7391 def __setitem__(self, key, val):
7392 if key == 0 and isinstance(val, _numpy.ndarray):
7393 self._ptr = <nvmlVgpuLicenseExpiry_t *>malloc(sizeof(nvmlVgpuLicenseExpiry_t))
7394 if self._ptr == NULL:
7395 raise MemoryError("Error allocating VgpuLicenseExpiry")
7396 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuLicenseExpiry_t))
7397 self._owner = None
7398 self._owned = True
7399 self._readonly = not val.flags.writeable
7400 else:
7401 setattr(self, key, val)
7403 @property
7404 def year(self):
7405 """int: """
7406 return self._ptr[0].year
7408 @year.setter
7409 def year(self, val):
7410 if self._readonly:
7411 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7412 self._ptr[0].year = val
7414 @property
7415 def month(self):
7416 """int: """
7417 return self._ptr[0].month
7419 @month.setter
7420 def month(self, val):
7421 if self._readonly:
7422 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7423 self._ptr[0].month = val
7425 @property
7426 def day(self):
7427 """int: """
7428 return self._ptr[0].day
7430 @day.setter
7431 def day(self, val):
7432 if self._readonly:
7433 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7434 self._ptr[0].day = val
7436 @property
7437 def hour(self):
7438 """int: """
7439 return self._ptr[0].hour
7441 @hour.setter
7442 def hour(self, val):
7443 if self._readonly:
7444 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7445 self._ptr[0].hour = val
7447 @property
7448 def min_(self):
7449 """int: """
7450 return self._ptr[0].min
7452 @min_.setter
7453 def min_(self, val):
7454 if self._readonly:
7455 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7456 self._ptr[0].min = val
7458 @property
7459 def sec(self):
7460 """int: """
7461 return self._ptr[0].sec
7463 @sec.setter
7464 def sec(self, val):
7465 if self._readonly:
7466 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7467 self._ptr[0].sec = val
7469 @property
7470 def status(self):
7471 """int: """
7472 return self._ptr[0].status
7474 @status.setter
7475 def status(self, val):
7476 if self._readonly:
7477 raise ValueError("This VgpuLicenseExpiry instance is read-only")
7478 self._ptr[0].status = val
7480 @staticmethod
7481 def from_data(data):
7482 """Create an VgpuLicenseExpiry instance wrapping the given NumPy array.
7484 Args:
7485 data (_numpy.ndarray): a single-element array of dtype `vgpu_license_expiry_dtype` holding the data.
7486 """
7487 return __from_data(data, "vgpu_license_expiry_dtype", vgpu_license_expiry_dtype, VgpuLicenseExpiry)
7489 @staticmethod
7490 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
7491 """Create an VgpuLicenseExpiry instance wrapping the given pointer.
7493 Args:
7494 ptr (intptr_t): pointer address as Python :class:`int` to the data.
7495 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
7496 readonly (bool): whether the data is read-only (to the user). default is `False`.
7497 """
7498 if ptr == 0:
7499 raise ValueError("ptr must not be null (0)")
7500 cdef VgpuLicenseExpiry obj = VgpuLicenseExpiry.__new__(VgpuLicenseExpiry)
7501 if owner is None:
7502 obj._ptr = <nvmlVgpuLicenseExpiry_t *>malloc(sizeof(nvmlVgpuLicenseExpiry_t))
7503 if obj._ptr == NULL:
7504 raise MemoryError("Error allocating VgpuLicenseExpiry")
7505 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuLicenseExpiry_t))
7506 obj._owner = None
7507 obj._owned = True
7508 else:
7509 obj._ptr = <nvmlVgpuLicenseExpiry_t *>ptr
7510 obj._owner = owner
7511 obj._owned = False
7512 obj._readonly = readonly
7513 return obj
7516cdef _get_grid_license_expiry_dtype_offsets():
7517 cdef nvmlGridLicenseExpiry_t pod = nvmlGridLicenseExpiry_t()
7518 return _numpy.dtype({
7519 'names': ['year', 'month', 'day', 'hour', 'min_', 'sec', 'status'],
7520 'formats': [_numpy.uint32, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint8],
7521 'offsets': [
7522 (<intptr_t>&(pod.year)) - (<intptr_t>&pod),
7523 (<intptr_t>&(pod.month)) - (<intptr_t>&pod),
7524 (<intptr_t>&(pod.day)) - (<intptr_t>&pod),
7525 (<intptr_t>&(pod.hour)) - (<intptr_t>&pod),
7526 (<intptr_t>&(pod.min)) - (<intptr_t>&pod),
7527 (<intptr_t>&(pod.sec)) - (<intptr_t>&pod),
7528 (<intptr_t>&(pod.status)) - (<intptr_t>&pod),
7529 ],
7530 'itemsize': sizeof(nvmlGridLicenseExpiry_t),
7531 })
7533grid_license_expiry_dtype = _get_grid_license_expiry_dtype_offsets()
7535cdef class GridLicenseExpiry:
7536 """Empty-initialize an instance of `nvmlGridLicenseExpiry_t`.
7539 .. seealso:: `nvmlGridLicenseExpiry_t`
7540 """
7541 cdef:
7542 nvmlGridLicenseExpiry_t *_ptr
7543 object _owner
7544 bint _owned
7545 bint _readonly
7547 def __init__(self):
7548 self._ptr = <nvmlGridLicenseExpiry_t *>calloc(1, sizeof(nvmlGridLicenseExpiry_t))
7549 if self._ptr == NULL:
7550 raise MemoryError("Error allocating GridLicenseExpiry")
7551 self._owner = None
7552 self._owned = True
7553 self._readonly = False
7555 def __dealloc__(self):
7556 cdef nvmlGridLicenseExpiry_t *ptr
7557 if self._owned and self._ptr != NULL:
7558 ptr = self._ptr
7559 self._ptr = NULL
7560 free(ptr)
7562 def __repr__(self):
7563 return f"<{__name__}.GridLicenseExpiry object at {hex(id(self))}>"
7565 @property
7566 def ptr(self):
7567 """Get the pointer address to the data as Python :class:`int`."""
7568 return <intptr_t>(self._ptr)
7570 cdef intptr_t _get_ptr(self):
7571 return <intptr_t>(self._ptr)
7573 def __int__(self):
7574 return <intptr_t>(self._ptr)
7576 def __eq__(self, other):
7577 cdef GridLicenseExpiry other_
7578 if not isinstance(other, GridLicenseExpiry):
7579 return False
7580 other_ = other
7581 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGridLicenseExpiry_t)) == 0)
7583 def __setitem__(self, key, val):
7584 if key == 0 and isinstance(val, _numpy.ndarray):
7585 self._ptr = <nvmlGridLicenseExpiry_t *>malloc(sizeof(nvmlGridLicenseExpiry_t))
7586 if self._ptr == NULL:
7587 raise MemoryError("Error allocating GridLicenseExpiry")
7588 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGridLicenseExpiry_t))
7589 self._owner = None
7590 self._owned = True
7591 self._readonly = not val.flags.writeable
7592 else:
7593 setattr(self, key, val)
7595 @property
7596 def year(self):
7597 """int: """
7598 return self._ptr[0].year
7600 @year.setter
7601 def year(self, val):
7602 if self._readonly:
7603 raise ValueError("This GridLicenseExpiry instance is read-only")
7604 self._ptr[0].year = val
7606 @property
7607 def month(self):
7608 """int: """
7609 return self._ptr[0].month
7611 @month.setter
7612 def month(self, val):
7613 if self._readonly:
7614 raise ValueError("This GridLicenseExpiry instance is read-only")
7615 self._ptr[0].month = val
7617 @property
7618 def day(self):
7619 """int: """
7620 return self._ptr[0].day
7622 @day.setter
7623 def day(self, val):
7624 if self._readonly:
7625 raise ValueError("This GridLicenseExpiry instance is read-only")
7626 self._ptr[0].day = val
7628 @property
7629 def hour(self):
7630 """int: """
7631 return self._ptr[0].hour
7633 @hour.setter
7634 def hour(self, val):
7635 if self._readonly:
7636 raise ValueError("This GridLicenseExpiry instance is read-only")
7637 self._ptr[0].hour = val
7639 @property
7640 def min_(self):
7641 """int: """
7642 return self._ptr[0].min
7644 @min_.setter
7645 def min_(self, val):
7646 if self._readonly:
7647 raise ValueError("This GridLicenseExpiry instance is read-only")
7648 self._ptr[0].min = val
7650 @property
7651 def sec(self):
7652 """int: """
7653 return self._ptr[0].sec
7655 @sec.setter
7656 def sec(self, val):
7657 if self._readonly:
7658 raise ValueError("This GridLicenseExpiry instance is read-only")
7659 self._ptr[0].sec = val
7661 @property
7662 def status(self):
7663 """int: """
7664 return self._ptr[0].status
7666 @status.setter
7667 def status(self, val):
7668 if self._readonly:
7669 raise ValueError("This GridLicenseExpiry instance is read-only")
7670 self._ptr[0].status = val
7672 @staticmethod
7673 def from_data(data):
7674 """Create an GridLicenseExpiry instance wrapping the given NumPy array.
7676 Args:
7677 data (_numpy.ndarray): a single-element array of dtype `grid_license_expiry_dtype` holding the data.
7678 """
7679 return __from_data(data, "grid_license_expiry_dtype", grid_license_expiry_dtype, GridLicenseExpiry)
7681 @staticmethod
7682 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
7683 """Create an GridLicenseExpiry instance wrapping the given pointer.
7685 Args:
7686 ptr (intptr_t): pointer address as Python :class:`int` to the data.
7687 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
7688 readonly (bool): whether the data is read-only (to the user). default is `False`.
7689 """
7690 if ptr == 0:
7691 raise ValueError("ptr must not be null (0)")
7692 cdef GridLicenseExpiry obj = GridLicenseExpiry.__new__(GridLicenseExpiry)
7693 if owner is None:
7694 obj._ptr = <nvmlGridLicenseExpiry_t *>malloc(sizeof(nvmlGridLicenseExpiry_t))
7695 if obj._ptr == NULL:
7696 raise MemoryError("Error allocating GridLicenseExpiry")
7697 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGridLicenseExpiry_t))
7698 obj._owner = None
7699 obj._owned = True
7700 else:
7701 obj._ptr = <nvmlGridLicenseExpiry_t *>ptr
7702 obj._owner = owner
7703 obj._owned = False
7704 obj._readonly = readonly
7705 return obj
7708cdef _get_vgpu_type_id_info_v1_dtype_offsets():
7709 cdef nvmlVgpuTypeIdInfo_v1_t pod = nvmlVgpuTypeIdInfo_v1_t()
7710 return _numpy.dtype({
7711 'names': ['version', 'vgpu_count', 'vgpu_type_ids'],
7712 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp],
7713 'offsets': [
7714 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
7715 (<intptr_t>&(pod.vgpuCount)) - (<intptr_t>&pod),
7716 (<intptr_t>&(pod.vgpuTypeIds)) - (<intptr_t>&pod),
7717 ],
7718 'itemsize': sizeof(nvmlVgpuTypeIdInfo_v1_t),
7719 })
7721vgpu_type_id_info_v1_dtype = _get_vgpu_type_id_info_v1_dtype_offsets()
7723cdef class VgpuTypeIdInfo_v1:
7724 """Empty-initialize an instance of `nvmlVgpuTypeIdInfo_v1_t`.
7727 .. seealso:: `nvmlVgpuTypeIdInfo_v1_t`
7728 """
7729 cdef:
7730 nvmlVgpuTypeIdInfo_v1_t *_ptr
7731 object _owner
7732 bint _owned
7733 bint _readonly
7735 def __init__(self):
7736 self._ptr = <nvmlVgpuTypeIdInfo_v1_t *>calloc(1, sizeof(nvmlVgpuTypeIdInfo_v1_t))
7737 if self._ptr == NULL:
7738 raise MemoryError("Error allocating VgpuTypeIdInfo_v1")
7739 self._owner = None
7740 self._owned = True
7741 self._readonly = False
7743 def __dealloc__(self):
7744 cdef nvmlVgpuTypeIdInfo_v1_t *ptr
7745 if self._owned and self._ptr != NULL:
7746 ptr = self._ptr
7747 self._ptr = NULL
7748 free(ptr)
7750 def __repr__(self):
7751 return f"<{__name__}.VgpuTypeIdInfo_v1 object at {hex(id(self))}>"
7753 @property
7754 def ptr(self):
7755 """Get the pointer address to the data as Python :class:`int`."""
7756 return <intptr_t>(self._ptr)
7758 cdef intptr_t _get_ptr(self):
7759 return <intptr_t>(self._ptr)
7761 def __int__(self):
7762 return <intptr_t>(self._ptr)
7764 def __eq__(self, other):
7765 cdef VgpuTypeIdInfo_v1 other_
7766 if not isinstance(other, VgpuTypeIdInfo_v1):
7767 return False
7768 other_ = other
7769 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuTypeIdInfo_v1_t)) == 0)
7771 def __setitem__(self, key, val):
7772 if key == 0 and isinstance(val, _numpy.ndarray):
7773 self._ptr = <nvmlVgpuTypeIdInfo_v1_t *>malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t))
7774 if self._ptr == NULL:
7775 raise MemoryError("Error allocating VgpuTypeIdInfo_v1")
7776 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuTypeIdInfo_v1_t))
7777 self._owner = None
7778 self._owned = True
7779 self._readonly = not val.flags.writeable
7780 else:
7781 setattr(self, key, val)
7783 @property
7784 def version(self):
7785 """int: IN: The version number of this struct."""
7786 return self._ptr[0].version
7788 @version.setter
7789 def version(self, val):
7790 if self._readonly:
7791 raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only")
7792 self._ptr[0].version = val
7794 @property
7795 def vgpu_type_ids(self):
7796 """int: OUT: List of vGPU type IDs."""
7797 if self._ptr[0].vgpuTypeIds == NULL:
7798 return []
7799 cdef view.array arr = view.array(shape=(self._ptr[0].vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False)
7800 arr.data = <char *>(self._ptr[0].vgpuTypeIds)
7801 return _numpy.asarray(arr)
7803 @vgpu_type_ids.setter
7804 def vgpu_type_ids(self, val):
7805 if self._readonly:
7806 raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only")
7807 cdef view.array arr = view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c")
7808 arr[:] = _numpy.asarray(val, dtype=_numpy.uint32)
7809 self._ptr[0].vgpuTypeIds = <nvmlVgpuTypeId_t*><intptr_t>(arr.data)
7810 self._ptr[0].vgpuCount = len(val)
7811 self._refs["vgpu_type_ids"] = arr
7813 @staticmethod
7814 def from_data(data):
7815 """Create an VgpuTypeIdInfo_v1 instance wrapping the given NumPy array.
7817 Args:
7818 data (_numpy.ndarray): a single-element array of dtype `vgpu_type_id_info_v1_dtype` holding the data.
7819 """
7820 return __from_data(data, "vgpu_type_id_info_v1_dtype", vgpu_type_id_info_v1_dtype, VgpuTypeIdInfo_v1)
7822 @staticmethod
7823 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
7824 """Create an VgpuTypeIdInfo_v1 instance wrapping the given pointer.
7826 Args:
7827 ptr (intptr_t): pointer address as Python :class:`int` to the data.
7828 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
7829 readonly (bool): whether the data is read-only (to the user). default is `False`.
7830 """
7831 if ptr == 0:
7832 raise ValueError("ptr must not be null (0)")
7833 cdef VgpuTypeIdInfo_v1 obj = VgpuTypeIdInfo_v1.__new__(VgpuTypeIdInfo_v1)
7834 if owner is None:
7835 obj._ptr = <nvmlVgpuTypeIdInfo_v1_t *>malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t))
7836 if obj._ptr == NULL:
7837 raise MemoryError("Error allocating VgpuTypeIdInfo_v1")
7838 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t))
7839 obj._owner = None
7840 obj._owned = True
7841 else:
7842 obj._ptr = <nvmlVgpuTypeIdInfo_v1_t *>ptr
7843 obj._owner = owner
7844 obj._owned = False
7845 obj._readonly = readonly
7846 return obj
7849cdef _get_active_vgpu_instance_info_v1_dtype_offsets():
7850 cdef nvmlActiveVgpuInstanceInfo_v1_t pod = nvmlActiveVgpuInstanceInfo_v1_t()
7851 return _numpy.dtype({
7852 'names': ['version', 'vgpu_count', 'vgpu_instances'],
7853 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp],
7854 'offsets': [
7855 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
7856 (<intptr_t>&(pod.vgpuCount)) - (<intptr_t>&pod),
7857 (<intptr_t>&(pod.vgpuInstances)) - (<intptr_t>&pod),
7858 ],
7859 'itemsize': sizeof(nvmlActiveVgpuInstanceInfo_v1_t),
7860 })
7862active_vgpu_instance_info_v1_dtype = _get_active_vgpu_instance_info_v1_dtype_offsets()
7864cdef class ActiveVgpuInstanceInfo_v1:
7865 """Empty-initialize an instance of `nvmlActiveVgpuInstanceInfo_v1_t`.
7868 .. seealso:: `nvmlActiveVgpuInstanceInfo_v1_t`
7869 """
7870 cdef:
7871 nvmlActiveVgpuInstanceInfo_v1_t *_ptr
7872 object _owner
7873 bint _owned
7874 bint _readonly
7876 def __init__(self):
7877 self._ptr = <nvmlActiveVgpuInstanceInfo_v1_t *>calloc(1, sizeof(nvmlActiveVgpuInstanceInfo_v1_t))
7878 if self._ptr == NULL:
7879 raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1")
7880 self._owner = None
7881 self._owned = True
7882 self._readonly = False
7884 def __dealloc__(self):
7885 cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr
7886 if self._owned and self._ptr != NULL:
7887 ptr = self._ptr
7888 self._ptr = NULL
7889 free(ptr)
7891 def __repr__(self):
7892 return f"<{__name__}.ActiveVgpuInstanceInfo_v1 object at {hex(id(self))}>"
7894 @property
7895 def ptr(self):
7896 """Get the pointer address to the data as Python :class:`int`."""
7897 return <intptr_t>(self._ptr)
7899 cdef intptr_t _get_ptr(self):
7900 return <intptr_t>(self._ptr)
7902 def __int__(self):
7903 return <intptr_t>(self._ptr)
7905 def __eq__(self, other):
7906 cdef ActiveVgpuInstanceInfo_v1 other_
7907 if not isinstance(other, ActiveVgpuInstanceInfo_v1):
7908 return False
7909 other_ = other
7910 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) == 0)
7912 def __setitem__(self, key, val):
7913 if key == 0 and isinstance(val, _numpy.ndarray):
7914 self._ptr = <nvmlActiveVgpuInstanceInfo_v1_t *>malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t))
7915 if self._ptr == NULL:
7916 raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1")
7917 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlActiveVgpuInstanceInfo_v1_t))
7918 self._owner = None
7919 self._owned = True
7920 self._readonly = not val.flags.writeable
7921 else:
7922 setattr(self, key, val)
7924 @property
7925 def version(self):
7926 """int: IN: The version number of this struct."""
7927 return self._ptr[0].version
7929 @version.setter
7930 def version(self, val):
7931 if self._readonly:
7932 raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only")
7933 self._ptr[0].version = val
7935 @property
7936 def vgpu_instances(self):
7937 """int: IN/OUT: list of active vGPU instances."""
7938 if self._ptr[0].vgpuInstances == NULL:
7939 return []
7940 cdef view.array arr = view.array(shape=(self._ptr[0].vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False)
7941 arr.data = <char *>(self._ptr[0].vgpuInstances)
7942 return _numpy.asarray(arr)
7944 @vgpu_instances.setter
7945 def vgpu_instances(self, val):
7946 if self._readonly:
7947 raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only")
7948 cdef view.array arr = view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c")
7949 arr[:] = _numpy.asarray(val, dtype=_numpy.uint32)
7950 self._ptr[0].vgpuInstances = <nvmlVgpuInstance_t*><intptr_t>(arr.data)
7951 self._ptr[0].vgpuCount = len(val)
7952 self._refs["vgpu_instances"] = arr
7954 @staticmethod
7955 def from_data(data):
7956 """Create an ActiveVgpuInstanceInfo_v1 instance wrapping the given NumPy array.
7958 Args:
7959 data (_numpy.ndarray): a single-element array of dtype `active_vgpu_instance_info_v1_dtype` holding the data.
7960 """
7961 return __from_data(data, "active_vgpu_instance_info_v1_dtype", active_vgpu_instance_info_v1_dtype, ActiveVgpuInstanceInfo_v1)
7963 @staticmethod
7964 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
7965 """Create an ActiveVgpuInstanceInfo_v1 instance wrapping the given pointer.
7967 Args:
7968 ptr (intptr_t): pointer address as Python :class:`int` to the data.
7969 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
7970 readonly (bool): whether the data is read-only (to the user). default is `False`.
7971 """
7972 if ptr == 0:
7973 raise ValueError("ptr must not be null (0)")
7974 cdef ActiveVgpuInstanceInfo_v1 obj = ActiveVgpuInstanceInfo_v1.__new__(ActiveVgpuInstanceInfo_v1)
7975 if owner is None:
7976 obj._ptr = <nvmlActiveVgpuInstanceInfo_v1_t *>malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t))
7977 if obj._ptr == NULL:
7978 raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1")
7979 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t))
7980 obj._owner = None
7981 obj._owned = True
7982 else:
7983 obj._ptr = <nvmlActiveVgpuInstanceInfo_v1_t *>ptr
7984 obj._owner = owner
7985 obj._owned = False
7986 obj._readonly = readonly
7987 return obj
7990cdef _get_vgpu_creatable_placement_info_v1_dtype_offsets():
7991 cdef nvmlVgpuCreatablePlacementInfo_v1_t pod = nvmlVgpuCreatablePlacementInfo_v1_t()
7992 return _numpy.dtype({
7993 'names': ['version', 'vgpu_type_id', 'count', 'placement_ids', 'placement_size'],
7994 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.uint32],
7995 'offsets': [
7996 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
7997 (<intptr_t>&(pod.vgpuTypeId)) - (<intptr_t>&pod),
7998 (<intptr_t>&(pod.count)) - (<intptr_t>&pod),
7999 (<intptr_t>&(pod.placementIds)) - (<intptr_t>&pod),
8000 (<intptr_t>&(pod.placementSize)) - (<intptr_t>&pod),
8001 ],
8002 'itemsize': sizeof(nvmlVgpuCreatablePlacementInfo_v1_t),
8003 })
8005vgpu_creatable_placement_info_v1_dtype = _get_vgpu_creatable_placement_info_v1_dtype_offsets()
8007cdef class VgpuCreatablePlacementInfo_v1:
8008 """Empty-initialize an instance of `nvmlVgpuCreatablePlacementInfo_v1_t`.
8011 .. seealso:: `nvmlVgpuCreatablePlacementInfo_v1_t`
8012 """
8013 cdef:
8014 nvmlVgpuCreatablePlacementInfo_v1_t *_ptr
8015 object _owner
8016 bint _owned
8017 bint _readonly
8018 dict _refs
8020 def __init__(self):
8021 self._ptr = <nvmlVgpuCreatablePlacementInfo_v1_t *>calloc(1, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t))
8022 if self._ptr == NULL:
8023 raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1")
8024 self._owner = None
8025 self._owned = True
8026 self._readonly = False
8027 self._refs = {}
8029 def __dealloc__(self):
8030 cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr
8031 if self._owned and self._ptr != NULL:
8032 ptr = self._ptr
8033 self._ptr = NULL
8034 free(ptr)
8036 def __repr__(self):
8037 return f"<{__name__}.VgpuCreatablePlacementInfo_v1 object at {hex(id(self))}>"
8039 @property
8040 def ptr(self):
8041 """Get the pointer address to the data as Python :class:`int`."""
8042 return <intptr_t>(self._ptr)
8044 cdef intptr_t _get_ptr(self):
8045 return <intptr_t>(self._ptr)
8047 def __int__(self):
8048 return <intptr_t>(self._ptr)
8050 def __eq__(self, other):
8051 cdef VgpuCreatablePlacementInfo_v1 other_
8052 if not isinstance(other, VgpuCreatablePlacementInfo_v1):
8053 return False
8054 other_ = other
8055 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) == 0)
8057 def __setitem__(self, key, val):
8058 if key == 0 and isinstance(val, _numpy.ndarray):
8059 self._ptr = <nvmlVgpuCreatablePlacementInfo_v1_t *>malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t))
8060 if self._ptr == NULL:
8061 raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1")
8062 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t))
8063 self._owner = None
8064 self._owned = True
8065 self._readonly = not val.flags.writeable
8066 else:
8067 setattr(self, key, val)
8069 @property
8070 def version(self):
8071 """int: IN: The version number of this struct."""
8072 return self._ptr[0].version
8074 @version.setter
8075 def version(self, val):
8076 if self._readonly:
8077 raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only")
8078 self._ptr[0].version = val
8080 @property
8081 def vgpu_type_id(self):
8082 """int: IN: Handle to vGPU type."""
8083 return <unsigned int>(self._ptr[0].vgpuTypeId)
8085 @vgpu_type_id.setter
8086 def vgpu_type_id(self, val):
8087 if self._readonly:
8088 raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only")
8089 self._ptr[0].vgpuTypeId = <nvmlVgpuTypeId_t><unsigned int>val
8091 @property
8092 def count(self):
8093 """int: IN/OUT: Count of the placement IDs."""
8094 return self._ptr[0].count
8096 @count.setter
8097 def count(self, val):
8098 if self._readonly:
8099 raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only")
8100 self._ptr[0].count = val
8102 @property
8103 def placement_ids(self):
8104 """int: IN/OUT: Placement IDs for the vGPU type."""
8105 if self._ptr[0].placementIds == NULL:
8106 return []
8107 cdef view.array arr = view.array(shape=(self._ptr[0].placementSize,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False)
8108 arr.data = <char *>(self._ptr[0].placementIds)
8109 return _numpy.asarray(arr)
8111 @placement_ids.setter
8112 def placement_ids(self, val):
8113 if self._readonly:
8114 raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only")
8115 cdef view.array arr = view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c")
8116 arr[:] = _numpy.asarray(val, dtype=_numpy.uint32)
8117 self._ptr[0].placementIds = <unsigned int*><intptr_t>(arr.data)
8118 self._ptr[0].placementSize = len(val)
8119 self._refs["placement_ids"] = arr
8121 @staticmethod
8122 def from_data(data):
8123 """Create an VgpuCreatablePlacementInfo_v1 instance wrapping the given NumPy array.
8125 Args:
8126 data (_numpy.ndarray): a single-element array of dtype `vgpu_creatable_placement_info_v1_dtype` holding the data.
8127 """
8128 return __from_data(data, "vgpu_creatable_placement_info_v1_dtype", vgpu_creatable_placement_info_v1_dtype, VgpuCreatablePlacementInfo_v1)
8130 @staticmethod
8131 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
8132 """Create an VgpuCreatablePlacementInfo_v1 instance wrapping the given pointer.
8134 Args:
8135 ptr (intptr_t): pointer address as Python :class:`int` to the data.
8136 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
8137 readonly (bool): whether the data is read-only (to the user). default is `False`.
8138 """
8139 if ptr == 0:
8140 raise ValueError("ptr must not be null (0)")
8141 cdef VgpuCreatablePlacementInfo_v1 obj = VgpuCreatablePlacementInfo_v1.__new__(VgpuCreatablePlacementInfo_v1)
8142 if owner is None:
8143 obj._ptr = <nvmlVgpuCreatablePlacementInfo_v1_t *>malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t))
8144 if obj._ptr == NULL:
8145 raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1")
8146 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t))
8147 obj._owner = None
8148 obj._owned = True
8149 else:
8150 obj._ptr = <nvmlVgpuCreatablePlacementInfo_v1_t *>ptr
8151 obj._owner = owner
8152 obj._owned = False
8153 obj._readonly = readonly
8154 obj._refs = {}
8155 return obj
8158cdef _get_hwbc_entry_dtype_offsets():
8159 cdef nvmlHwbcEntry_t pod = nvmlHwbcEntry_t()
8160 return _numpy.dtype({
8161 'names': ['hwbc_id', 'firmware_version'],
8162 'formats': [_numpy.uint32, (_numpy.int8, 32)],
8163 'offsets': [
8164 (<intptr_t>&(pod.hwbcId)) - (<intptr_t>&pod),
8165 (<intptr_t>&(pod.firmwareVersion)) - (<intptr_t>&pod),
8166 ],
8167 'itemsize': sizeof(nvmlHwbcEntry_t),
8168 })
8170hwbc_entry_dtype = _get_hwbc_entry_dtype_offsets()
8172cdef class HwbcEntry:
8173 """Empty-initialize an array of `nvmlHwbcEntry_t`.
8175 The resulting object is of length `size` and of dtype `hwbc_entry_dtype`.
8176 If default-constructed, the instance represents a single struct.
8178 Args:
8179 size (int): number of structs, default=1.
8182 .. seealso:: `nvmlHwbcEntry_t`
8183 """
8184 cdef:
8185 readonly object _data
8189 def __init__(self, size=1):
8190 arr = _numpy.empty(size, dtype=hwbc_entry_dtype)
8191 self._data = arr.view(_numpy.recarray)
8192 assert self._data.itemsize == sizeof(nvmlHwbcEntry_t), \
8193 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlHwbcEntry_t) }"
8195 def __repr__(self):
8196 if self._data.size > 1:
8197 return f"<{__name__}.HwbcEntry_Array_{self._data.size} object at {hex(id(self))}>"
8198 else:
8199 return f"<{__name__}.HwbcEntry object at {hex(id(self))}>"
8201 @property
8202 def ptr(self):
8203 """Get the pointer address to the data as Python :class:`int`."""
8204 return self._data.ctypes.data
8206 cdef intptr_t _get_ptr(self):
8207 return self._data.ctypes.data
8209 def __int__(self):
8210 if self._data.size > 1:
8211 raise TypeError("int() argument must be a bytes-like object of size 1. "
8212 "To get the pointer address of an array, use .ptr")
8213 return self._data.ctypes.data
8215 def __len__(self):
8216 return self._data.size
8218 def __eq__(self, other):
8219 cdef object self_data = self._data
8220 if (not isinstance(other, HwbcEntry)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
8221 return False
8222 return bool((self_data == other._data).all())
8224 @property
8225 def hwbc_id(self):
8226 """Union[~_numpy.uint32, int]: """
8227 if self._data.size == 1:
8228 return int(self._data.hwbc_id[0])
8229 return self._data.hwbc_id
8231 @hwbc_id.setter
8232 def hwbc_id(self, val):
8233 self._data.hwbc_id = val
8235 @property
8236 def firmware_version(self):
8237 """~_numpy.int8: (array of length 32)."""
8238 return self._data.firmware_version
8240 @firmware_version.setter
8241 def firmware_version(self, val):
8242 self._data.firmware_version = val
8244 def __getitem__(self, key):
8245 cdef ssize_t key_
8246 cdef ssize_t size
8247 if isinstance(key, int):
8248 key_ = key
8249 size = self._data.size
8250 if key_ >= size or key_ <= -(size+1):
8251 raise IndexError("index is out of bounds")
8252 if key_ < 0:
8253 key_ += size
8254 return HwbcEntry.from_data(self._data[key_:key_+1])
8255 out = self._data[key]
8256 if isinstance(out, _numpy.recarray) and out.dtype == hwbc_entry_dtype:
8257 return HwbcEntry.from_data(out)
8258 return out
8260 def __setitem__(self, key, val):
8261 self._data[key] = val
8263 @staticmethod
8264 def from_data(data):
8265 """Create an HwbcEntry instance wrapping the given NumPy array.
8267 Args:
8268 data (_numpy.ndarray): a 1D array of dtype `hwbc_entry_dtype` holding the data.
8269 """
8270 cdef HwbcEntry obj = HwbcEntry.__new__(HwbcEntry)
8271 if not isinstance(data, _numpy.ndarray):
8272 raise TypeError("data argument must be a NumPy ndarray")
8273 if data.ndim != 1:
8274 raise ValueError("data array must be 1D")
8275 if data.dtype != hwbc_entry_dtype:
8276 raise ValueError("data array must be of dtype hwbc_entry_dtype")
8277 obj._data = data.view(_numpy.recarray)
8279 return obj
8281 @staticmethod
8282 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
8283 """Create an HwbcEntry instance wrapping the given pointer.
8285 Args:
8286 ptr (intptr_t): pointer address as Python :class:`int` to the data.
8287 size (int): number of structs, default=1.
8288 readonly (bool): whether the data is read-only (to the user). default is `False`.
8289 """
8290 if ptr == 0:
8291 raise ValueError("ptr must not be null (0)")
8292 cdef HwbcEntry obj = HwbcEntry.__new__(HwbcEntry)
8293 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
8294 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
8295 <char*>ptr, sizeof(nvmlHwbcEntry_t) * size, flag)
8296 data = _numpy.ndarray(size, buffer=buf, dtype=hwbc_entry_dtype)
8297 obj._data = data.view(_numpy.recarray)
8299 return obj
8302cdef _get_led_state_dtype_offsets():
8303 cdef nvmlLedState_t pod = nvmlLedState_t()
8304 return _numpy.dtype({
8305 'names': ['cause', 'color'],
8306 'formats': [(_numpy.int8, 256), _numpy.int32],
8307 'offsets': [
8308 (<intptr_t>&(pod.cause)) - (<intptr_t>&pod),
8309 (<intptr_t>&(pod.color)) - (<intptr_t>&pod),
8310 ],
8311 'itemsize': sizeof(nvmlLedState_t),
8312 })
8314led_state_dtype = _get_led_state_dtype_offsets()
8316cdef class LedState:
8317 """Empty-initialize an instance of `nvmlLedState_t`.
8320 .. seealso:: `nvmlLedState_t`
8321 """
8322 cdef:
8323 nvmlLedState_t *_ptr
8324 object _owner
8325 bint _owned
8326 bint _readonly
8328 def __init__(self):
8329 self._ptr = <nvmlLedState_t *>calloc(1, sizeof(nvmlLedState_t))
8330 if self._ptr == NULL:
8331 raise MemoryError("Error allocating LedState")
8332 self._owner = None
8333 self._owned = True
8334 self._readonly = False
8336 def __dealloc__(self):
8337 cdef nvmlLedState_t *ptr
8338 if self._owned and self._ptr != NULL:
8339 ptr = self._ptr
8340 self._ptr = NULL
8341 free(ptr)
8343 def __repr__(self):
8344 return f"<{__name__}.LedState object at {hex(id(self))}>"
8346 @property
8347 def ptr(self):
8348 """Get the pointer address to the data as Python :class:`int`."""
8349 return <intptr_t>(self._ptr)
8351 cdef intptr_t _get_ptr(self):
8352 return <intptr_t>(self._ptr)
8354 def __int__(self):
8355 return <intptr_t>(self._ptr)
8357 def __eq__(self, other):
8358 cdef LedState other_
8359 if not isinstance(other, LedState):
8360 return False
8361 other_ = other
8362 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlLedState_t)) == 0)
8364 def __setitem__(self, key, val):
8365 if key == 0 and isinstance(val, _numpy.ndarray):
8366 self._ptr = <nvmlLedState_t *>malloc(sizeof(nvmlLedState_t))
8367 if self._ptr == NULL:
8368 raise MemoryError("Error allocating LedState")
8369 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlLedState_t))
8370 self._owner = None
8371 self._owned = True
8372 self._readonly = not val.flags.writeable
8373 else:
8374 setattr(self, key, val)
8376 @property
8377 def cause(self):
8378 """~_numpy.int8: (array of length 256)."""
8379 return cpython.PyUnicode_FromString(self._ptr[0].cause)
8381 @cause.setter
8382 def cause(self, val):
8383 if self._readonly:
8384 raise ValueError("This LedState instance is read-only")
8385 cdef bytes buf = val.encode()
8386 if len(buf) >= 256:
8387 raise ValueError("String too long for field cause, max length is 255")
8388 cdef char *ptr = buf
8389 memcpy(<void *>(self._ptr[0].cause), <void *>ptr, 256)
8391 @property
8392 def color(self):
8393 """int: """
8394 return <int>(self._ptr[0].color)
8396 @color.setter
8397 def color(self, val):
8398 if self._readonly:
8399 raise ValueError("This LedState instance is read-only")
8400 self._ptr[0].color = <nvmlLedColor_t><int>val
8402 @staticmethod
8403 def from_data(data):
8404 """Create an LedState instance wrapping the given NumPy array.
8406 Args:
8407 data (_numpy.ndarray): a single-element array of dtype `led_state_dtype` holding the data.
8408 """
8409 return __from_data(data, "led_state_dtype", led_state_dtype, LedState)
8411 @staticmethod
8412 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
8413 """Create an LedState instance wrapping the given pointer.
8415 Args:
8416 ptr (intptr_t): pointer address as Python :class:`int` to the data.
8417 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
8418 readonly (bool): whether the data is read-only (to the user). default is `False`.
8419 """
8420 if ptr == 0:
8421 raise ValueError("ptr must not be null (0)")
8422 cdef LedState obj = LedState.__new__(LedState)
8423 if owner is None:
8424 obj._ptr = <nvmlLedState_t *>malloc(sizeof(nvmlLedState_t))
8425 if obj._ptr == NULL:
8426 raise MemoryError("Error allocating LedState")
8427 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlLedState_t))
8428 obj._owner = None
8429 obj._owned = True
8430 else:
8431 obj._ptr = <nvmlLedState_t *>ptr
8432 obj._owner = owner
8433 obj._owned = False
8434 obj._readonly = readonly
8435 return obj
8438cdef _get_unit_info_dtype_offsets():
8439 cdef nvmlUnitInfo_t pod = nvmlUnitInfo_t()
8440 return _numpy.dtype({
8441 'names': ['name', 'id', 'serial', 'firmware_version'],
8442 'formats': [(_numpy.int8, 96), (_numpy.int8, 96), (_numpy.int8, 96), (_numpy.int8, 96)],
8443 'offsets': [
8444 (<intptr_t>&(pod.name)) - (<intptr_t>&pod),
8445 (<intptr_t>&(pod.id)) - (<intptr_t>&pod),
8446 (<intptr_t>&(pod.serial)) - (<intptr_t>&pod),
8447 (<intptr_t>&(pod.firmwareVersion)) - (<intptr_t>&pod),
8448 ],
8449 'itemsize': sizeof(nvmlUnitInfo_t),
8450 })
8452unit_info_dtype = _get_unit_info_dtype_offsets()
8454cdef class UnitInfo:
8455 """Empty-initialize an instance of `nvmlUnitInfo_t`.
8458 .. seealso:: `nvmlUnitInfo_t`
8459 """
8460 cdef:
8461 nvmlUnitInfo_t *_ptr
8462 object _owner
8463 bint _owned
8464 bint _readonly
8466 def __init__(self):
8467 self._ptr = <nvmlUnitInfo_t *>calloc(1, sizeof(nvmlUnitInfo_t))
8468 if self._ptr == NULL:
8469 raise MemoryError("Error allocating UnitInfo")
8470 self._owner = None
8471 self._owned = True
8472 self._readonly = False
8474 def __dealloc__(self):
8475 cdef nvmlUnitInfo_t *ptr
8476 if self._owned and self._ptr != NULL:
8477 ptr = self._ptr
8478 self._ptr = NULL
8479 free(ptr)
8481 def __repr__(self):
8482 return f"<{__name__}.UnitInfo object at {hex(id(self))}>"
8484 @property
8485 def ptr(self):
8486 """Get the pointer address to the data as Python :class:`int`."""
8487 return <intptr_t>(self._ptr)
8489 cdef intptr_t _get_ptr(self):
8490 return <intptr_t>(self._ptr)
8492 def __int__(self):
8493 return <intptr_t>(self._ptr)
8495 def __eq__(self, other):
8496 cdef UnitInfo other_
8497 if not isinstance(other, UnitInfo):
8498 return False
8499 other_ = other
8500 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlUnitInfo_t)) == 0)
8502 def __setitem__(self, key, val):
8503 if key == 0 and isinstance(val, _numpy.ndarray):
8504 self._ptr = <nvmlUnitInfo_t *>malloc(sizeof(nvmlUnitInfo_t))
8505 if self._ptr == NULL:
8506 raise MemoryError("Error allocating UnitInfo")
8507 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlUnitInfo_t))
8508 self._owner = None
8509 self._owned = True
8510 self._readonly = not val.flags.writeable
8511 else:
8512 setattr(self, key, val)
8514 @property
8515 def name(self):
8516 """~_numpy.int8: (array of length 96)."""
8517 return cpython.PyUnicode_FromString(self._ptr[0].name)
8519 @name.setter
8520 def name(self, val):
8521 if self._readonly:
8522 raise ValueError("This UnitInfo instance is read-only")
8523 cdef bytes buf = val.encode()
8524 if len(buf) >= 96:
8525 raise ValueError("String too long for field name, max length is 95")
8526 cdef char *ptr = buf
8527 memcpy(<void *>(self._ptr[0].name), <void *>ptr, 96)
8529 @property
8530 def id(self):
8531 """~_numpy.int8: (array of length 96)."""
8532 return cpython.PyUnicode_FromString(self._ptr[0].id)
8534 @id.setter
8535 def id(self, val):
8536 if self._readonly:
8537 raise ValueError("This UnitInfo instance is read-only")
8538 cdef bytes buf = val.encode()
8539 if len(buf) >= 96:
8540 raise ValueError("String too long for field id, max length is 95")
8541 cdef char *ptr = buf
8542 memcpy(<void *>(self._ptr[0].id), <void *>ptr, 96)
8544 @property
8545 def serial(self):
8546 """~_numpy.int8: (array of length 96)."""
8547 return cpython.PyUnicode_FromString(self._ptr[0].serial)
8549 @serial.setter
8550 def serial(self, val):
8551 if self._readonly:
8552 raise ValueError("This UnitInfo instance is read-only")
8553 cdef bytes buf = val.encode()
8554 if len(buf) >= 96:
8555 raise ValueError("String too long for field serial, max length is 95")
8556 cdef char *ptr = buf
8557 memcpy(<void *>(self._ptr[0].serial), <void *>ptr, 96)
8559 @property
8560 def firmware_version(self):
8561 """~_numpy.int8: (array of length 96)."""
8562 return cpython.PyUnicode_FromString(self._ptr[0].firmwareVersion)
8564 @firmware_version.setter
8565 def firmware_version(self, val):
8566 if self._readonly:
8567 raise ValueError("This UnitInfo instance is read-only")
8568 cdef bytes buf = val.encode()
8569 if len(buf) >= 96:
8570 raise ValueError("String too long for field firmware_version, max length is 95")
8571 cdef char *ptr = buf
8572 memcpy(<void *>(self._ptr[0].firmwareVersion), <void *>ptr, 96)
8574 @staticmethod
8575 def from_data(data):
8576 """Create an UnitInfo instance wrapping the given NumPy array.
8578 Args:
8579 data (_numpy.ndarray): a single-element array of dtype `unit_info_dtype` holding the data.
8580 """
8581 return __from_data(data, "unit_info_dtype", unit_info_dtype, UnitInfo)
8583 @staticmethod
8584 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
8585 """Create an UnitInfo instance wrapping the given pointer.
8587 Args:
8588 ptr (intptr_t): pointer address as Python :class:`int` to the data.
8589 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
8590 readonly (bool): whether the data is read-only (to the user). default is `False`.
8591 """
8592 if ptr == 0:
8593 raise ValueError("ptr must not be null (0)")
8594 cdef UnitInfo obj = UnitInfo.__new__(UnitInfo)
8595 if owner is None:
8596 obj._ptr = <nvmlUnitInfo_t *>malloc(sizeof(nvmlUnitInfo_t))
8597 if obj._ptr == NULL:
8598 raise MemoryError("Error allocating UnitInfo")
8599 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlUnitInfo_t))
8600 obj._owner = None
8601 obj._owned = True
8602 else:
8603 obj._ptr = <nvmlUnitInfo_t *>ptr
8604 obj._owner = owner
8605 obj._owned = False
8606 obj._readonly = readonly
8607 return obj
8610cdef _get_psu_info_dtype_offsets():
8611 cdef nvmlPSUInfo_t pod = nvmlPSUInfo_t()
8612 return _numpy.dtype({
8613 'names': ['state', 'current', 'voltage', 'power'],
8614 'formats': [(_numpy.int8, 256), _numpy.uint32, _numpy.uint32, _numpy.uint32],
8615 'offsets': [
8616 (<intptr_t>&(pod.state)) - (<intptr_t>&pod),
8617 (<intptr_t>&(pod.current)) - (<intptr_t>&pod),
8618 (<intptr_t>&(pod.voltage)) - (<intptr_t>&pod),
8619 (<intptr_t>&(pod.power)) - (<intptr_t>&pod),
8620 ],
8621 'itemsize': sizeof(nvmlPSUInfo_t),
8622 })
8624psu_info_dtype = _get_psu_info_dtype_offsets()
8626cdef class PSUInfo:
8627 """Empty-initialize an instance of `nvmlPSUInfo_t`.
8630 .. seealso:: `nvmlPSUInfo_t`
8631 """
8632 cdef:
8633 nvmlPSUInfo_t *_ptr
8634 object _owner
8635 bint _owned
8636 bint _readonly
8638 def __init__(self):
8639 self._ptr = <nvmlPSUInfo_t *>calloc(1, sizeof(nvmlPSUInfo_t))
8640 if self._ptr == NULL:
8641 raise MemoryError("Error allocating PSUInfo")
8642 self._owner = None
8643 self._owned = True
8644 self._readonly = False
8646 def __dealloc__(self):
8647 cdef nvmlPSUInfo_t *ptr
8648 if self._owned and self._ptr != NULL:
8649 ptr = self._ptr
8650 self._ptr = NULL
8651 free(ptr)
8653 def __repr__(self):
8654 return f"<{__name__}.PSUInfo object at {hex(id(self))}>"
8656 @property
8657 def ptr(self):
8658 """Get the pointer address to the data as Python :class:`int`."""
8659 return <intptr_t>(self._ptr)
8661 cdef intptr_t _get_ptr(self):
8662 return <intptr_t>(self._ptr)
8664 def __int__(self):
8665 return <intptr_t>(self._ptr)
8667 def __eq__(self, other):
8668 cdef PSUInfo other_
8669 if not isinstance(other, PSUInfo):
8670 return False
8671 other_ = other
8672 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPSUInfo_t)) == 0)
8674 def __setitem__(self, key, val):
8675 if key == 0 and isinstance(val, _numpy.ndarray):
8676 self._ptr = <nvmlPSUInfo_t *>malloc(sizeof(nvmlPSUInfo_t))
8677 if self._ptr == NULL:
8678 raise MemoryError("Error allocating PSUInfo")
8679 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPSUInfo_t))
8680 self._owner = None
8681 self._owned = True
8682 self._readonly = not val.flags.writeable
8683 else:
8684 setattr(self, key, val)
8686 @property
8687 def state(self):
8688 """~_numpy.int8: (array of length 256)."""
8689 return cpython.PyUnicode_FromString(self._ptr[0].state)
8691 @state.setter
8692 def state(self, val):
8693 if self._readonly:
8694 raise ValueError("This PSUInfo instance is read-only")
8695 cdef bytes buf = val.encode()
8696 if len(buf) >= 256:
8697 raise ValueError("String too long for field state, max length is 255")
8698 cdef char *ptr = buf
8699 memcpy(<void *>(self._ptr[0].state), <void *>ptr, 256)
8701 @property
8702 def current(self):
8703 """int: """
8704 return self._ptr[0].current
8706 @current.setter
8707 def current(self, val):
8708 if self._readonly:
8709 raise ValueError("This PSUInfo instance is read-only")
8710 self._ptr[0].current = val
8712 @property
8713 def voltage(self):
8714 """int: """
8715 return self._ptr[0].voltage
8717 @voltage.setter
8718 def voltage(self, val):
8719 if self._readonly:
8720 raise ValueError("This PSUInfo instance is read-only")
8721 self._ptr[0].voltage = val
8723 @property
8724 def power(self):
8725 """int: """
8726 return self._ptr[0].power
8728 @power.setter
8729 def power(self, val):
8730 if self._readonly:
8731 raise ValueError("This PSUInfo instance is read-only")
8732 self._ptr[0].power = val
8734 @staticmethod
8735 def from_data(data):
8736 """Create an PSUInfo instance wrapping the given NumPy array.
8738 Args:
8739 data (_numpy.ndarray): a single-element array of dtype `psu_info_dtype` holding the data.
8740 """
8741 return __from_data(data, "psu_info_dtype", psu_info_dtype, PSUInfo)
8743 @staticmethod
8744 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
8745 """Create an PSUInfo instance wrapping the given pointer.
8747 Args:
8748 ptr (intptr_t): pointer address as Python :class:`int` to the data.
8749 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
8750 readonly (bool): whether the data is read-only (to the user). default is `False`.
8751 """
8752 if ptr == 0:
8753 raise ValueError("ptr must not be null (0)")
8754 cdef PSUInfo obj = PSUInfo.__new__(PSUInfo)
8755 if owner is None:
8756 obj._ptr = <nvmlPSUInfo_t *>malloc(sizeof(nvmlPSUInfo_t))
8757 if obj._ptr == NULL:
8758 raise MemoryError("Error allocating PSUInfo")
8759 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPSUInfo_t))
8760 obj._owner = None
8761 obj._owned = True
8762 else:
8763 obj._ptr = <nvmlPSUInfo_t *>ptr
8764 obj._owner = owner
8765 obj._owned = False
8766 obj._readonly = readonly
8767 return obj
8770cdef _get_unit_fan_info_dtype_offsets():
8771 cdef nvmlUnitFanInfo_t pod = nvmlUnitFanInfo_t()
8772 return _numpy.dtype({
8773 'names': ['speed', 'state'],
8774 'formats': [_numpy.uint32, _numpy.int32],
8775 'offsets': [
8776 (<intptr_t>&(pod.speed)) - (<intptr_t>&pod),
8777 (<intptr_t>&(pod.state)) - (<intptr_t>&pod),
8778 ],
8779 'itemsize': sizeof(nvmlUnitFanInfo_t),
8780 })
8782unit_fan_info_dtype = _get_unit_fan_info_dtype_offsets()
8784cdef class UnitFanInfo:
8785 """Empty-initialize an array of `nvmlUnitFanInfo_t`.
8787 The resulting object is of length `size` and of dtype `unit_fan_info_dtype`.
8788 If default-constructed, the instance represents a single struct.
8790 Args:
8791 size (int): number of structs, default=1.
8794 .. seealso:: `nvmlUnitFanInfo_t`
8795 """
8796 cdef:
8797 readonly object _data
8801 def __init__(self, size=1):
8802 arr = _numpy.empty(size, dtype=unit_fan_info_dtype)
8803 self._data = arr.view(_numpy.recarray)
8804 assert self._data.itemsize == sizeof(nvmlUnitFanInfo_t), \
8805 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlUnitFanInfo_t) }"
8807 def __repr__(self):
8808 if self._data.size > 1:
8809 return f"<{__name__}.UnitFanInfo_Array_{self._data.size} object at {hex(id(self))}>"
8810 else:
8811 return f"<{__name__}.UnitFanInfo object at {hex(id(self))}>"
8813 @property
8814 def ptr(self):
8815 """Get the pointer address to the data as Python :class:`int`."""
8816 return self._data.ctypes.data
8818 cdef intptr_t _get_ptr(self):
8819 return self._data.ctypes.data
8821 def __int__(self):
8822 if self._data.size > 1:
8823 raise TypeError("int() argument must be a bytes-like object of size 1. "
8824 "To get the pointer address of an array, use .ptr")
8825 return self._data.ctypes.data
8827 def __len__(self):
8828 return self._data.size
8830 def __eq__(self, other):
8831 cdef object self_data = self._data
8832 if (not isinstance(other, UnitFanInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
8833 return False
8834 return bool((self_data == other._data).all())
8836 @property
8837 def speed(self):
8838 """Union[~_numpy.uint32, int]: """
8839 if self._data.size == 1:
8840 return int(self._data.speed[0])
8841 return self._data.speed
8843 @speed.setter
8844 def speed(self, val):
8845 self._data.speed = val
8847 @property
8848 def state(self):
8849 """Union[~_numpy.int32, int]: """
8850 if self._data.size == 1:
8851 return int(self._data.state[0])
8852 return self._data.state
8854 @state.setter
8855 def state(self, val):
8856 self._data.state = val
8858 def __getitem__(self, key):
8859 cdef ssize_t key_
8860 cdef ssize_t size
8861 if isinstance(key, int):
8862 key_ = key
8863 size = self._data.size
8864 if key_ >= size or key_ <= -(size+1):
8865 raise IndexError("index is out of bounds")
8866 if key_ < 0:
8867 key_ += size
8868 return UnitFanInfo.from_data(self._data[key_:key_+1])
8869 out = self._data[key]
8870 if isinstance(out, _numpy.recarray) and out.dtype == unit_fan_info_dtype:
8871 return UnitFanInfo.from_data(out)
8872 return out
8874 def __setitem__(self, key, val):
8875 self._data[key] = val
8877 @staticmethod
8878 def from_data(data):
8879 """Create an UnitFanInfo instance wrapping the given NumPy array.
8881 Args:
8882 data (_numpy.ndarray): a 1D array of dtype `unit_fan_info_dtype` holding the data.
8883 """
8884 cdef UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo)
8885 if not isinstance(data, _numpy.ndarray):
8886 raise TypeError("data argument must be a NumPy ndarray")
8887 if data.ndim != 1:
8888 raise ValueError("data array must be 1D")
8889 if data.dtype != unit_fan_info_dtype:
8890 raise ValueError("data array must be of dtype unit_fan_info_dtype")
8891 obj._data = data.view(_numpy.recarray)
8893 return obj
8895 @staticmethod
8896 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
8897 """Create an UnitFanInfo instance wrapping the given pointer.
8899 Args:
8900 ptr (intptr_t): pointer address as Python :class:`int` to the data.
8901 size (int): number of structs, default=1.
8902 readonly (bool): whether the data is read-only (to the user). default is `False`.
8903 """
8904 if ptr == 0:
8905 raise ValueError("ptr must not be null (0)")
8906 cdef UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo)
8907 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
8908 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
8909 <char*>ptr, sizeof(nvmlUnitFanInfo_t) * size, flag)
8910 data = _numpy.ndarray(size, buffer=buf, dtype=unit_fan_info_dtype)
8911 obj._data = data.view(_numpy.recarray)
8913 return obj
8916cdef _get_event_data_dtype_offsets():
8917 cdef nvmlEventData_t pod = nvmlEventData_t()
8918 return _numpy.dtype({
8919 'names': ['device_', 'event_type', 'event_data', 'gpu_instance_id', 'compute_instance_id'],
8920 'formats': [_numpy.intp, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint32],
8921 'offsets': [
8922 (<intptr_t>&(pod.device)) - (<intptr_t>&pod),
8923 (<intptr_t>&(pod.eventType)) - (<intptr_t>&pod),
8924 (<intptr_t>&(pod.eventData)) - (<intptr_t>&pod),
8925 (<intptr_t>&(pod.gpuInstanceId)) - (<intptr_t>&pod),
8926 (<intptr_t>&(pod.computeInstanceId)) - (<intptr_t>&pod),
8927 ],
8928 'itemsize': sizeof(nvmlEventData_t),
8929 })
8931event_data_dtype = _get_event_data_dtype_offsets()
8933cdef class EventData:
8934 """Empty-initialize an instance of `nvmlEventData_t`.
8937 .. seealso:: `nvmlEventData_t`
8938 """
8939 cdef:
8940 nvmlEventData_t *_ptr
8941 object _owner
8942 bint _owned
8943 bint _readonly
8945 def __init__(self):
8946 self._ptr = <nvmlEventData_t *>calloc(1, sizeof(nvmlEventData_t)) 1h
8947 if self._ptr == NULL: 1h
8948 raise MemoryError("Error allocating EventData")
8949 self._owner = None 1h
8950 self._owned = True 1h
8951 self._readonly = False 1h
8953 def __dealloc__(self):
8954 cdef nvmlEventData_t *ptr
8955 if self._owned and self._ptr != NULL: 1h
8956 ptr = self._ptr 1h
8957 self._ptr = NULL 1h
8958 free(ptr) 1h
8960 def __repr__(self):
8961 return f"<{__name__}.EventData object at {hex(id(self))}>"
8963 @property
8964 def ptr(self):
8965 """Get the pointer address to the data as Python :class:`int`."""
8966 return <intptr_t>(self._ptr)
8968 cdef intptr_t _get_ptr(self):
8969 return <intptr_t>(self._ptr) 1h
8971 def __int__(self):
8972 return <intptr_t>(self._ptr)
8974 def __eq__(self, other):
8975 cdef EventData other_
8976 if not isinstance(other, EventData):
8977 return False
8978 other_ = other
8979 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlEventData_t)) == 0)
8981 def __setitem__(self, key, val):
8982 if key == 0 and isinstance(val, _numpy.ndarray):
8983 self._ptr = <nvmlEventData_t *>malloc(sizeof(nvmlEventData_t))
8984 if self._ptr == NULL:
8985 raise MemoryError("Error allocating EventData")
8986 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlEventData_t))
8987 self._owner = None
8988 self._owned = True
8989 self._readonly = not val.flags.writeable
8990 else:
8991 setattr(self, key, val)
8993 @property
8994 def device_(self):
8995 """int: """
8996 return <intptr_t>(self._ptr[0].device)
8998 @device_.setter
8999 def device_(self, val):
9000 if self._readonly:
9001 raise ValueError("This EventData instance is read-only")
9002 self._ptr[0].device = <nvmlDevice_t><intptr_t>val
9004 @property
9005 def event_type(self):
9006 """int: """
9007 return self._ptr[0].eventType
9009 @event_type.setter
9010 def event_type(self, val):
9011 if self._readonly:
9012 raise ValueError("This EventData instance is read-only")
9013 self._ptr[0].eventType = val
9015 @property
9016 def event_data(self):
9017 """int: """
9018 return self._ptr[0].eventData
9020 @event_data.setter
9021 def event_data(self, val):
9022 if self._readonly:
9023 raise ValueError("This EventData instance is read-only")
9024 self._ptr[0].eventData = val
9026 @property
9027 def gpu_instance_id(self):
9028 """int: """
9029 return self._ptr[0].gpuInstanceId
9031 @gpu_instance_id.setter
9032 def gpu_instance_id(self, val):
9033 if self._readonly:
9034 raise ValueError("This EventData instance is read-only")
9035 self._ptr[0].gpuInstanceId = val
9037 @property
9038 def compute_instance_id(self):
9039 """int: """
9040 return self._ptr[0].computeInstanceId
9042 @compute_instance_id.setter
9043 def compute_instance_id(self, val):
9044 if self._readonly:
9045 raise ValueError("This EventData instance is read-only")
9046 self._ptr[0].computeInstanceId = val
9048 @staticmethod
9049 def from_data(data):
9050 """Create an EventData instance wrapping the given NumPy array.
9052 Args:
9053 data (_numpy.ndarray): a single-element array of dtype `event_data_dtype` holding the data.
9054 """
9055 return __from_data(data, "event_data_dtype", event_data_dtype, EventData)
9057 @staticmethod
9058 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
9059 """Create an EventData instance wrapping the given pointer.
9061 Args:
9062 ptr (intptr_t): pointer address as Python :class:`int` to the data.
9063 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
9064 readonly (bool): whether the data is read-only (to the user). default is `False`.
9065 """
9066 if ptr == 0:
9067 raise ValueError("ptr must not be null (0)")
9068 cdef EventData obj = EventData.__new__(EventData)
9069 if owner is None:
9070 obj._ptr = <nvmlEventData_t *>malloc(sizeof(nvmlEventData_t))
9071 if obj._ptr == NULL:
9072 raise MemoryError("Error allocating EventData")
9073 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlEventData_t))
9074 obj._owner = None
9075 obj._owned = True
9076 else:
9077 obj._ptr = <nvmlEventData_t *>ptr
9078 obj._owner = owner
9079 obj._owned = False
9080 obj._readonly = readonly
9081 return obj
9084cdef _get_system_event_data_v1_dtype_offsets():
9085 cdef nvmlSystemEventData_v1_t pod = nvmlSystemEventData_v1_t()
9086 return _numpy.dtype({
9087 'names': ['event_type', 'gpu_id'],
9088 'formats': [_numpy.uint64, _numpy.uint32],
9089 'offsets': [
9090 (<intptr_t>&(pod.eventType)) - (<intptr_t>&pod),
9091 (<intptr_t>&(pod.gpuId)) - (<intptr_t>&pod),
9092 ],
9093 'itemsize': sizeof(nvmlSystemEventData_v1_t),
9094 })
9096system_event_data_v1_dtype = _get_system_event_data_v1_dtype_offsets()
9098cdef class SystemEventData_v1:
9099 """Empty-initialize an array of `nvmlSystemEventData_v1_t`.
9101 The resulting object is of length `size` and of dtype `system_event_data_v1_dtype`.
9102 If default-constructed, the instance represents a single struct.
9104 Args:
9105 size (int): number of structs, default=1.
9108 .. seealso:: `nvmlSystemEventData_v1_t`
9109 """
9110 cdef:
9111 readonly object _data
9115 def __init__(self, size=1):
9116 arr = _numpy.empty(size, dtype=system_event_data_v1_dtype) 1l
9117 self._data = arr.view(_numpy.recarray) 1l
9118 assert self._data.itemsize == sizeof(nvmlSystemEventData_v1_t), \ 1l
9119 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlSystemEventData_v1_t) }"
9121 def __repr__(self):
9122 if self._data.size > 1:
9123 return f"<{__name__}.SystemEventData_v1_Array_{self._data.size} object at {hex(id(self))}>"
9124 else:
9125 return f"<{__name__}.SystemEventData_v1 object at {hex(id(self))}>"
9127 @property
9128 def ptr(self):
9129 """Get the pointer address to the data as Python :class:`int`."""
9130 return self._data.ctypes.data
9132 cdef intptr_t _get_ptr(self):
9133 return self._data.ctypes.data 1l
9135 def __int__(self):
9136 if self._data.size > 1:
9137 raise TypeError("int() argument must be a bytes-like object of size 1. "
9138 "To get the pointer address of an array, use .ptr")
9139 return self._data.ctypes.data
9141 def __len__(self):
9142 return self._data.size
9144 def __eq__(self, other):
9145 cdef object self_data = self._data
9146 if (not isinstance(other, SystemEventData_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
9147 return False
9148 return bool((self_data == other._data).all())
9150 @property
9151 def event_type(self):
9152 """Union[~_numpy.uint64, int]: Information about what specific system event occurred."""
9153 if self._data.size == 1:
9154 return int(self._data.event_type[0])
9155 return self._data.event_type
9157 @event_type.setter
9158 def event_type(self, val):
9159 self._data.event_type = val
9161 @property
9162 def gpu_id(self):
9163 """Union[~_numpy.uint32, int]: gpuId in PCI format"""
9164 if self._data.size == 1:
9165 return int(self._data.gpu_id[0])
9166 return self._data.gpu_id
9168 @gpu_id.setter
9169 def gpu_id(self, val):
9170 self._data.gpu_id = val
9172 def __getitem__(self, key):
9173 cdef ssize_t key_
9174 cdef ssize_t size
9175 if isinstance(key, int):
9176 key_ = key
9177 size = self._data.size
9178 if key_ >= size or key_ <= -(size+1):
9179 raise IndexError("index is out of bounds")
9180 if key_ < 0:
9181 key_ += size
9182 return SystemEventData_v1.from_data(self._data[key_:key_+1])
9183 out = self._data[key]
9184 if isinstance(out, _numpy.recarray) and out.dtype == system_event_data_v1_dtype:
9185 return SystemEventData_v1.from_data(out)
9186 return out
9188 def __setitem__(self, key, val):
9189 self._data[key] = val
9191 @staticmethod
9192 def from_data(data):
9193 """Create an SystemEventData_v1 instance wrapping the given NumPy array.
9195 Args:
9196 data (_numpy.ndarray): a 1D array of dtype `system_event_data_v1_dtype` holding the data.
9197 """
9198 cdef SystemEventData_v1 obj = SystemEventData_v1.__new__(SystemEventData_v1)
9199 if not isinstance(data, _numpy.ndarray):
9200 raise TypeError("data argument must be a NumPy ndarray")
9201 if data.ndim != 1:
9202 raise ValueError("data array must be 1D")
9203 if data.dtype != system_event_data_v1_dtype:
9204 raise ValueError("data array must be of dtype system_event_data_v1_dtype")
9205 obj._data = data.view(_numpy.recarray)
9207 return obj
9209 @staticmethod
9210 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
9211 """Create an SystemEventData_v1 instance wrapping the given pointer.
9213 Args:
9214 ptr (intptr_t): pointer address as Python :class:`int` to the data.
9215 size (int): number of structs, default=1.
9216 readonly (bool): whether the data is read-only (to the user). default is `False`.
9217 """
9218 if ptr == 0:
9219 raise ValueError("ptr must not be null (0)")
9220 cdef SystemEventData_v1 obj = SystemEventData_v1.__new__(SystemEventData_v1)
9221 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
9222 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
9223 <char*>ptr, sizeof(nvmlSystemEventData_v1_t) * size, flag)
9224 data = _numpy.ndarray(size, buffer=buf, dtype=system_event_data_v1_dtype)
9225 obj._data = data.view(_numpy.recarray)
9227 return obj
9230cdef _get_accounting_stats_dtype_offsets():
9231 cdef nvmlAccountingStats_t pod = nvmlAccountingStats_t()
9232 return _numpy.dtype({
9233 'names': ['gpu_utilization', 'memory_utilization', 'max_memory_usage', 'time', 'start_time', 'is_running', 'reserved'],
9234 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, (_numpy.uint32, 5)],
9235 'offsets': [
9236 (<intptr_t>&(pod.gpuUtilization)) - (<intptr_t>&pod),
9237 (<intptr_t>&(pod.memoryUtilization)) - (<intptr_t>&pod),
9238 (<intptr_t>&(pod.maxMemoryUsage)) - (<intptr_t>&pod),
9239 (<intptr_t>&(pod.time)) - (<intptr_t>&pod),
9240 (<intptr_t>&(pod.startTime)) - (<intptr_t>&pod),
9241 (<intptr_t>&(pod.isRunning)) - (<intptr_t>&pod),
9242 (<intptr_t>&(pod.reserved)) - (<intptr_t>&pod),
9243 ],
9244 'itemsize': sizeof(nvmlAccountingStats_t),
9245 })
9247accounting_stats_dtype = _get_accounting_stats_dtype_offsets()
9249cdef class AccountingStats:
9250 """Empty-initialize an instance of `nvmlAccountingStats_t`.
9253 .. seealso:: `nvmlAccountingStats_t`
9254 """
9255 cdef:
9256 nvmlAccountingStats_t *_ptr
9257 object _owner
9258 bint _owned
9259 bint _readonly
9261 def __init__(self):
9262 self._ptr = <nvmlAccountingStats_t *>calloc(1, sizeof(nvmlAccountingStats_t))
9263 if self._ptr == NULL:
9264 raise MemoryError("Error allocating AccountingStats")
9265 self._owner = None
9266 self._owned = True
9267 self._readonly = False
9269 def __dealloc__(self):
9270 cdef nvmlAccountingStats_t *ptr
9271 if self._owned and self._ptr != NULL:
9272 ptr = self._ptr
9273 self._ptr = NULL
9274 free(ptr)
9276 def __repr__(self):
9277 return f"<{__name__}.AccountingStats object at {hex(id(self))}>"
9279 @property
9280 def ptr(self):
9281 """Get the pointer address to the data as Python :class:`int`."""
9282 return <intptr_t>(self._ptr)
9284 cdef intptr_t _get_ptr(self):
9285 return <intptr_t>(self._ptr)
9287 def __int__(self):
9288 return <intptr_t>(self._ptr)
9290 def __eq__(self, other):
9291 cdef AccountingStats other_
9292 if not isinstance(other, AccountingStats):
9293 return False
9294 other_ = other
9295 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlAccountingStats_t)) == 0)
9297 def __setitem__(self, key, val):
9298 if key == 0 and isinstance(val, _numpy.ndarray):
9299 self._ptr = <nvmlAccountingStats_t *>malloc(sizeof(nvmlAccountingStats_t))
9300 if self._ptr == NULL:
9301 raise MemoryError("Error allocating AccountingStats")
9302 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlAccountingStats_t))
9303 self._owner = None
9304 self._owned = True
9305 self._readonly = not val.flags.writeable
9306 else:
9307 setattr(self, key, val)
9309 @property
9310 def gpu_utilization(self):
9311 """int: """
9312 return self._ptr[0].gpuUtilization
9314 @gpu_utilization.setter
9315 def gpu_utilization(self, val):
9316 if self._readonly:
9317 raise ValueError("This AccountingStats instance is read-only")
9318 self._ptr[0].gpuUtilization = val
9320 @property
9321 def memory_utilization(self):
9322 """int: """
9323 return self._ptr[0].memoryUtilization
9325 @memory_utilization.setter
9326 def memory_utilization(self, val):
9327 if self._readonly:
9328 raise ValueError("This AccountingStats instance is read-only")
9329 self._ptr[0].memoryUtilization = val
9331 @property
9332 def max_memory_usage(self):
9333 """int: """
9334 return self._ptr[0].maxMemoryUsage
9336 @max_memory_usage.setter
9337 def max_memory_usage(self, val):
9338 if self._readonly:
9339 raise ValueError("This AccountingStats instance is read-only")
9340 self._ptr[0].maxMemoryUsage = val
9342 @property
9343 def time(self):
9344 """int: """
9345 return self._ptr[0].time
9347 @time.setter
9348 def time(self, val):
9349 if self._readonly:
9350 raise ValueError("This AccountingStats instance is read-only")
9351 self._ptr[0].time = val
9353 @property
9354 def start_time(self):
9355 """int: """
9356 return self._ptr[0].startTime
9358 @start_time.setter
9359 def start_time(self, val):
9360 if self._readonly:
9361 raise ValueError("This AccountingStats instance is read-only")
9362 self._ptr[0].startTime = val
9364 @property
9365 def is_running(self):
9366 """int: """
9367 return self._ptr[0].isRunning
9369 @is_running.setter
9370 def is_running(self, val):
9371 if self._readonly:
9372 raise ValueError("This AccountingStats instance is read-only")
9373 self._ptr[0].isRunning = val
9375 @staticmethod
9376 def from_data(data):
9377 """Create an AccountingStats instance wrapping the given NumPy array.
9379 Args:
9380 data (_numpy.ndarray): a single-element array of dtype `accounting_stats_dtype` holding the data.
9381 """
9382 return __from_data(data, "accounting_stats_dtype", accounting_stats_dtype, AccountingStats)
9384 @staticmethod
9385 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
9386 """Create an AccountingStats instance wrapping the given pointer.
9388 Args:
9389 ptr (intptr_t): pointer address as Python :class:`int` to the data.
9390 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
9391 readonly (bool): whether the data is read-only (to the user). default is `False`.
9392 """
9393 if ptr == 0:
9394 raise ValueError("ptr must not be null (0)")
9395 cdef AccountingStats obj = AccountingStats.__new__(AccountingStats)
9396 if owner is None:
9397 obj._ptr = <nvmlAccountingStats_t *>malloc(sizeof(nvmlAccountingStats_t))
9398 if obj._ptr == NULL:
9399 raise MemoryError("Error allocating AccountingStats")
9400 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlAccountingStats_t))
9401 obj._owner = None
9402 obj._owned = True
9403 else:
9404 obj._ptr = <nvmlAccountingStats_t *>ptr
9405 obj._owner = owner
9406 obj._owned = False
9407 obj._readonly = readonly
9408 return obj
9411cdef _get_encoder_session_info_dtype_offsets():
9412 cdef nvmlEncoderSessionInfo_t pod = nvmlEncoderSessionInfo_t()
9413 return _numpy.dtype({
9414 'names': ['session_id', 'pid', 'vgpu_instance', 'codec_type', 'h_resolution', 'v_resolution', 'average_fps', 'average_latency'],
9415 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
9416 'offsets': [
9417 (<intptr_t>&(pod.sessionId)) - (<intptr_t>&pod),
9418 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
9419 (<intptr_t>&(pod.vgpuInstance)) - (<intptr_t>&pod),
9420 (<intptr_t>&(pod.codecType)) - (<intptr_t>&pod),
9421 (<intptr_t>&(pod.hResolution)) - (<intptr_t>&pod),
9422 (<intptr_t>&(pod.vResolution)) - (<intptr_t>&pod),
9423 (<intptr_t>&(pod.averageFps)) - (<intptr_t>&pod),
9424 (<intptr_t>&(pod.averageLatency)) - (<intptr_t>&pod),
9425 ],
9426 'itemsize': sizeof(nvmlEncoderSessionInfo_t),
9427 })
9429encoder_session_info_dtype = _get_encoder_session_info_dtype_offsets()
9431cdef class EncoderSessionInfo:
9432 """Empty-initialize an array of `nvmlEncoderSessionInfo_t`.
9434 The resulting object is of length `size` and of dtype `encoder_session_info_dtype`.
9435 If default-constructed, the instance represents a single struct.
9437 Args:
9438 size (int): number of structs, default=1.
9441 .. seealso:: `nvmlEncoderSessionInfo_t`
9442 """
9443 cdef:
9444 readonly object _data
9448 def __init__(self, size=1):
9449 arr = _numpy.empty(size, dtype=encoder_session_info_dtype)
9450 self._data = arr.view(_numpy.recarray)
9451 assert self._data.itemsize == sizeof(nvmlEncoderSessionInfo_t), \
9452 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlEncoderSessionInfo_t) }"
9454 def __repr__(self):
9455 if self._data.size > 1:
9456 return f"<{__name__}.EncoderSessionInfo_Array_{self._data.size} object at {hex(id(self))}>"
9457 else:
9458 return f"<{__name__}.EncoderSessionInfo object at {hex(id(self))}>"
9460 @property
9461 def ptr(self):
9462 """Get the pointer address to the data as Python :class:`int`."""
9463 return self._data.ctypes.data
9465 cdef intptr_t _get_ptr(self):
9466 return self._data.ctypes.data
9468 def __int__(self):
9469 if self._data.size > 1:
9470 raise TypeError("int() argument must be a bytes-like object of size 1. "
9471 "To get the pointer address of an array, use .ptr")
9472 return self._data.ctypes.data
9474 def __len__(self):
9475 return self._data.size
9477 def __eq__(self, other):
9478 cdef object self_data = self._data
9479 if (not isinstance(other, EncoderSessionInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
9480 return False
9481 return bool((self_data == other._data).all())
9483 @property
9484 def session_id(self):
9485 """Union[~_numpy.uint32, int]: """
9486 if self._data.size == 1:
9487 return int(self._data.session_id[0])
9488 return self._data.session_id
9490 @session_id.setter
9491 def session_id(self, val):
9492 self._data.session_id = val
9494 @property
9495 def pid(self):
9496 """Union[~_numpy.uint32, int]: """
9497 if self._data.size == 1:
9498 return int(self._data.pid[0])
9499 return self._data.pid
9501 @pid.setter
9502 def pid(self, val):
9503 self._data.pid = val
9505 @property
9506 def vgpu_instance(self):
9507 """Union[~_numpy.uint32, int]: """
9508 if self._data.size == 1:
9509 return int(self._data.vgpu_instance[0])
9510 return self._data.vgpu_instance
9512 @vgpu_instance.setter
9513 def vgpu_instance(self, val):
9514 self._data.vgpu_instance = val
9516 @property
9517 def codec_type(self):
9518 """Union[~_numpy.int32, int]: """
9519 if self._data.size == 1:
9520 return int(self._data.codec_type[0])
9521 return self._data.codec_type
9523 @codec_type.setter
9524 def codec_type(self, val):
9525 self._data.codec_type = val
9527 @property
9528 def h_resolution(self):
9529 """Union[~_numpy.uint32, int]: """
9530 if self._data.size == 1:
9531 return int(self._data.h_resolution[0])
9532 return self._data.h_resolution
9534 @h_resolution.setter
9535 def h_resolution(self, val):
9536 self._data.h_resolution = val
9538 @property
9539 def v_resolution(self):
9540 """Union[~_numpy.uint32, int]: """
9541 if self._data.size == 1:
9542 return int(self._data.v_resolution[0])
9543 return self._data.v_resolution
9545 @v_resolution.setter
9546 def v_resolution(self, val):
9547 self._data.v_resolution = val
9549 @property
9550 def average_fps(self):
9551 """Union[~_numpy.uint32, int]: """
9552 if self._data.size == 1:
9553 return int(self._data.average_fps[0])
9554 return self._data.average_fps
9556 @average_fps.setter
9557 def average_fps(self, val):
9558 self._data.average_fps = val
9560 @property
9561 def average_latency(self):
9562 """Union[~_numpy.uint32, int]: """
9563 if self._data.size == 1:
9564 return int(self._data.average_latency[0])
9565 return self._data.average_latency
9567 @average_latency.setter
9568 def average_latency(self, val):
9569 self._data.average_latency = val
9571 def __getitem__(self, key):
9572 cdef ssize_t key_
9573 cdef ssize_t size
9574 if isinstance(key, int):
9575 key_ = key
9576 size = self._data.size
9577 if key_ >= size or key_ <= -(size+1):
9578 raise IndexError("index is out of bounds")
9579 if key_ < 0:
9580 key_ += size
9581 return EncoderSessionInfo.from_data(self._data[key_:key_+1])
9582 out = self._data[key]
9583 if isinstance(out, _numpy.recarray) and out.dtype == encoder_session_info_dtype:
9584 return EncoderSessionInfo.from_data(out)
9585 return out
9587 def __setitem__(self, key, val):
9588 self._data[key] = val
9590 @staticmethod
9591 def from_data(data):
9592 """Create an EncoderSessionInfo instance wrapping the given NumPy array.
9594 Args:
9595 data (_numpy.ndarray): a 1D array of dtype `encoder_session_info_dtype` holding the data.
9596 """
9597 cdef EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo)
9598 if not isinstance(data, _numpy.ndarray):
9599 raise TypeError("data argument must be a NumPy ndarray")
9600 if data.ndim != 1:
9601 raise ValueError("data array must be 1D")
9602 if data.dtype != encoder_session_info_dtype:
9603 raise ValueError("data array must be of dtype encoder_session_info_dtype")
9604 obj._data = data.view(_numpy.recarray)
9606 return obj
9608 @staticmethod
9609 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
9610 """Create an EncoderSessionInfo instance wrapping the given pointer.
9612 Args:
9613 ptr (intptr_t): pointer address as Python :class:`int` to the data.
9614 size (int): number of structs, default=1.
9615 readonly (bool): whether the data is read-only (to the user). default is `False`.
9616 """
9617 if ptr == 0:
9618 raise ValueError("ptr must not be null (0)")
9619 cdef EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo)
9620 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
9621 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
9622 <char*>ptr, sizeof(nvmlEncoderSessionInfo_t) * size, flag)
9623 data = _numpy.ndarray(size, buffer=buf, dtype=encoder_session_info_dtype)
9624 obj._data = data.view(_numpy.recarray)
9626 return obj
9629cdef _get_fbc_stats_dtype_offsets():
9630 cdef nvmlFBCStats_t pod = nvmlFBCStats_t()
9631 return _numpy.dtype({
9632 'names': ['sessions_count', 'average_fps', 'average_latency'],
9633 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32],
9634 'offsets': [
9635 (<intptr_t>&(pod.sessionsCount)) - (<intptr_t>&pod),
9636 (<intptr_t>&(pod.averageFPS)) - (<intptr_t>&pod),
9637 (<intptr_t>&(pod.averageLatency)) - (<intptr_t>&pod),
9638 ],
9639 'itemsize': sizeof(nvmlFBCStats_t),
9640 })
9642fbc_stats_dtype = _get_fbc_stats_dtype_offsets()
9644cdef class FBCStats:
9645 """Empty-initialize an instance of `nvmlFBCStats_t`.
9648 .. seealso:: `nvmlFBCStats_t`
9649 """
9650 cdef:
9651 nvmlFBCStats_t *_ptr
9652 object _owner
9653 bint _owned
9654 bint _readonly
9656 def __init__(self):
9657 self._ptr = <nvmlFBCStats_t *>calloc(1, sizeof(nvmlFBCStats_t))
9658 if self._ptr == NULL:
9659 raise MemoryError("Error allocating FBCStats")
9660 self._owner = None
9661 self._owned = True
9662 self._readonly = False
9664 def __dealloc__(self):
9665 cdef nvmlFBCStats_t *ptr
9666 if self._owned and self._ptr != NULL:
9667 ptr = self._ptr
9668 self._ptr = NULL
9669 free(ptr)
9671 def __repr__(self):
9672 return f"<{__name__}.FBCStats object at {hex(id(self))}>"
9674 @property
9675 def ptr(self):
9676 """Get the pointer address to the data as Python :class:`int`."""
9677 return <intptr_t>(self._ptr)
9679 cdef intptr_t _get_ptr(self):
9680 return <intptr_t>(self._ptr)
9682 def __int__(self):
9683 return <intptr_t>(self._ptr)
9685 def __eq__(self, other):
9686 cdef FBCStats other_
9687 if not isinstance(other, FBCStats):
9688 return False
9689 other_ = other
9690 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlFBCStats_t)) == 0)
9692 def __setitem__(self, key, val):
9693 if key == 0 and isinstance(val, _numpy.ndarray):
9694 self._ptr = <nvmlFBCStats_t *>malloc(sizeof(nvmlFBCStats_t))
9695 if self._ptr == NULL:
9696 raise MemoryError("Error allocating FBCStats")
9697 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlFBCStats_t))
9698 self._owner = None
9699 self._owned = True
9700 self._readonly = not val.flags.writeable
9701 else:
9702 setattr(self, key, val)
9704 @property
9705 def sessions_count(self):
9706 """int: """
9707 return self._ptr[0].sessionsCount
9709 @sessions_count.setter
9710 def sessions_count(self, val):
9711 if self._readonly:
9712 raise ValueError("This FBCStats instance is read-only")
9713 self._ptr[0].sessionsCount = val
9715 @property
9716 def average_fps(self):
9717 """int: """
9718 return self._ptr[0].averageFPS
9720 @average_fps.setter
9721 def average_fps(self, val):
9722 if self._readonly:
9723 raise ValueError("This FBCStats instance is read-only")
9724 self._ptr[0].averageFPS = val
9726 @property
9727 def average_latency(self):
9728 """int: """
9729 return self._ptr[0].averageLatency
9731 @average_latency.setter
9732 def average_latency(self, val):
9733 if self._readonly:
9734 raise ValueError("This FBCStats instance is read-only")
9735 self._ptr[0].averageLatency = val
9737 @staticmethod
9738 def from_data(data):
9739 """Create an FBCStats instance wrapping the given NumPy array.
9741 Args:
9742 data (_numpy.ndarray): a single-element array of dtype `fbc_stats_dtype` holding the data.
9743 """
9744 return __from_data(data, "fbc_stats_dtype", fbc_stats_dtype, FBCStats)
9746 @staticmethod
9747 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
9748 """Create an FBCStats instance wrapping the given pointer.
9750 Args:
9751 ptr (intptr_t): pointer address as Python :class:`int` to the data.
9752 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
9753 readonly (bool): whether the data is read-only (to the user). default is `False`.
9754 """
9755 if ptr == 0:
9756 raise ValueError("ptr must not be null (0)")
9757 cdef FBCStats obj = FBCStats.__new__(FBCStats)
9758 if owner is None:
9759 obj._ptr = <nvmlFBCStats_t *>malloc(sizeof(nvmlFBCStats_t))
9760 if obj._ptr == NULL:
9761 raise MemoryError("Error allocating FBCStats")
9762 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlFBCStats_t))
9763 obj._owner = None
9764 obj._owned = True
9765 else:
9766 obj._ptr = <nvmlFBCStats_t *>ptr
9767 obj._owner = owner
9768 obj._owned = False
9769 obj._readonly = readonly
9770 return obj
9773cdef _get_fbc_session_info_dtype_offsets():
9774 cdef nvmlFBCSessionInfo_t pod = nvmlFBCSessionInfo_t()
9775 return _numpy.dtype({
9776 'names': ['session_id', 'pid', 'vgpu_instance', 'display_ordinal', 'session_type', 'session_flags', 'h_max_resolution', 'v_max_resolution', 'h_resolution', 'v_resolution', 'average_fps', 'average_latency'],
9777 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
9778 'offsets': [
9779 (<intptr_t>&(pod.sessionId)) - (<intptr_t>&pod),
9780 (<intptr_t>&(pod.pid)) - (<intptr_t>&pod),
9781 (<intptr_t>&(pod.vgpuInstance)) - (<intptr_t>&pod),
9782 (<intptr_t>&(pod.displayOrdinal)) - (<intptr_t>&pod),
9783 (<intptr_t>&(pod.sessionType)) - (<intptr_t>&pod),
9784 (<intptr_t>&(pod.sessionFlags)) - (<intptr_t>&pod),
9785 (<intptr_t>&(pod.hMaxResolution)) - (<intptr_t>&pod),
9786 (<intptr_t>&(pod.vMaxResolution)) - (<intptr_t>&pod),
9787 (<intptr_t>&(pod.hResolution)) - (<intptr_t>&pod),
9788 (<intptr_t>&(pod.vResolution)) - (<intptr_t>&pod),
9789 (<intptr_t>&(pod.averageFPS)) - (<intptr_t>&pod),
9790 (<intptr_t>&(pod.averageLatency)) - (<intptr_t>&pod),
9791 ],
9792 'itemsize': sizeof(nvmlFBCSessionInfo_t),
9793 })
9795fbc_session_info_dtype = _get_fbc_session_info_dtype_offsets()
9797cdef class FBCSessionInfo:
9798 """Empty-initialize an array of `nvmlFBCSessionInfo_t`.
9800 The resulting object is of length `size` and of dtype `fbc_session_info_dtype`.
9801 If default-constructed, the instance represents a single struct.
9803 Args:
9804 size (int): number of structs, default=1.
9807 .. seealso:: `nvmlFBCSessionInfo_t`
9808 """
9809 cdef:
9810 readonly object _data
9814 def __init__(self, size=1):
9815 arr = _numpy.empty(size, dtype=fbc_session_info_dtype)
9816 self._data = arr.view(_numpy.recarray)
9817 assert self._data.itemsize == sizeof(nvmlFBCSessionInfo_t), \
9818 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlFBCSessionInfo_t) }"
9820 def __repr__(self):
9821 if self._data.size > 1:
9822 return f"<{__name__}.FBCSessionInfo_Array_{self._data.size} object at {hex(id(self))}>"
9823 else:
9824 return f"<{__name__}.FBCSessionInfo object at {hex(id(self))}>"
9826 @property
9827 def ptr(self):
9828 """Get the pointer address to the data as Python :class:`int`."""
9829 return self._data.ctypes.data
9831 cdef intptr_t _get_ptr(self):
9832 return self._data.ctypes.data
9834 def __int__(self):
9835 if self._data.size > 1:
9836 raise TypeError("int() argument must be a bytes-like object of size 1. "
9837 "To get the pointer address of an array, use .ptr")
9838 return self._data.ctypes.data
9840 def __len__(self):
9841 return self._data.size
9843 def __eq__(self, other):
9844 cdef object self_data = self._data
9845 if (not isinstance(other, FBCSessionInfo)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
9846 return False
9847 return bool((self_data == other._data).all())
9849 @property
9850 def session_id(self):
9851 """Union[~_numpy.uint32, int]: """
9852 if self._data.size == 1:
9853 return int(self._data.session_id[0])
9854 return self._data.session_id
9856 @session_id.setter
9857 def session_id(self, val):
9858 self._data.session_id = val
9860 @property
9861 def pid(self):
9862 """Union[~_numpy.uint32, int]: """
9863 if self._data.size == 1:
9864 return int(self._data.pid[0])
9865 return self._data.pid
9867 @pid.setter
9868 def pid(self, val):
9869 self._data.pid = val
9871 @property
9872 def vgpu_instance(self):
9873 """Union[~_numpy.uint32, int]: """
9874 if self._data.size == 1:
9875 return int(self._data.vgpu_instance[0])
9876 return self._data.vgpu_instance
9878 @vgpu_instance.setter
9879 def vgpu_instance(self, val):
9880 self._data.vgpu_instance = val
9882 @property
9883 def display_ordinal(self):
9884 """Union[~_numpy.uint32, int]: """
9885 if self._data.size == 1:
9886 return int(self._data.display_ordinal[0])
9887 return self._data.display_ordinal
9889 @display_ordinal.setter
9890 def display_ordinal(self, val):
9891 self._data.display_ordinal = val
9893 @property
9894 def session_type(self):
9895 """Union[~_numpy.int32, int]: """
9896 if self._data.size == 1:
9897 return int(self._data.session_type[0])
9898 return self._data.session_type
9900 @session_type.setter
9901 def session_type(self, val):
9902 self._data.session_type = val
9904 @property
9905 def session_flags(self):
9906 """Union[~_numpy.uint32, int]: """
9907 if self._data.size == 1:
9908 return int(self._data.session_flags[0])
9909 return self._data.session_flags
9911 @session_flags.setter
9912 def session_flags(self, val):
9913 self._data.session_flags = val
9915 @property
9916 def h_max_resolution(self):
9917 """Union[~_numpy.uint32, int]: """
9918 if self._data.size == 1:
9919 return int(self._data.h_max_resolution[0])
9920 return self._data.h_max_resolution
9922 @h_max_resolution.setter
9923 def h_max_resolution(self, val):
9924 self._data.h_max_resolution = val
9926 @property
9927 def v_max_resolution(self):
9928 """Union[~_numpy.uint32, int]: """
9929 if self._data.size == 1:
9930 return int(self._data.v_max_resolution[0])
9931 return self._data.v_max_resolution
9933 @v_max_resolution.setter
9934 def v_max_resolution(self, val):
9935 self._data.v_max_resolution = val
9937 @property
9938 def h_resolution(self):
9939 """Union[~_numpy.uint32, int]: """
9940 if self._data.size == 1:
9941 return int(self._data.h_resolution[0])
9942 return self._data.h_resolution
9944 @h_resolution.setter
9945 def h_resolution(self, val):
9946 self._data.h_resolution = val
9948 @property
9949 def v_resolution(self):
9950 """Union[~_numpy.uint32, int]: """
9951 if self._data.size == 1:
9952 return int(self._data.v_resolution[0])
9953 return self._data.v_resolution
9955 @v_resolution.setter
9956 def v_resolution(self, val):
9957 self._data.v_resolution = val
9959 @property
9960 def average_fps(self):
9961 """Union[~_numpy.uint32, int]: """
9962 if self._data.size == 1:
9963 return int(self._data.average_fps[0])
9964 return self._data.average_fps
9966 @average_fps.setter
9967 def average_fps(self, val):
9968 self._data.average_fps = val
9970 @property
9971 def average_latency(self):
9972 """Union[~_numpy.uint32, int]: """
9973 if self._data.size == 1:
9974 return int(self._data.average_latency[0])
9975 return self._data.average_latency
9977 @average_latency.setter
9978 def average_latency(self, val):
9979 self._data.average_latency = val
9981 def __getitem__(self, key):
9982 cdef ssize_t key_
9983 cdef ssize_t size
9984 if isinstance(key, int):
9985 key_ = key
9986 size = self._data.size
9987 if key_ >= size or key_ <= -(size+1):
9988 raise IndexError("index is out of bounds")
9989 if key_ < 0:
9990 key_ += size
9991 return FBCSessionInfo.from_data(self._data[key_:key_+1])
9992 out = self._data[key]
9993 if isinstance(out, _numpy.recarray) and out.dtype == fbc_session_info_dtype:
9994 return FBCSessionInfo.from_data(out)
9995 return out
9997 def __setitem__(self, key, val):
9998 self._data[key] = val
10000 @staticmethod
10001 def from_data(data):
10002 """Create an FBCSessionInfo instance wrapping the given NumPy array.
10004 Args:
10005 data (_numpy.ndarray): a 1D array of dtype `fbc_session_info_dtype` holding the data.
10006 """
10007 cdef FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo)
10008 if not isinstance(data, _numpy.ndarray):
10009 raise TypeError("data argument must be a NumPy ndarray")
10010 if data.ndim != 1:
10011 raise ValueError("data array must be 1D")
10012 if data.dtype != fbc_session_info_dtype:
10013 raise ValueError("data array must be of dtype fbc_session_info_dtype")
10014 obj._data = data.view(_numpy.recarray)
10016 return obj
10018 @staticmethod
10019 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
10020 """Create an FBCSessionInfo instance wrapping the given pointer.
10022 Args:
10023 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10024 size (int): number of structs, default=1.
10025 readonly (bool): whether the data is read-only (to the user). default is `False`.
10026 """
10027 if ptr == 0:
10028 raise ValueError("ptr must not be null (0)")
10029 cdef FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo)
10030 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
10031 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
10032 <char*>ptr, sizeof(nvmlFBCSessionInfo_t) * size, flag)
10033 data = _numpy.ndarray(size, buffer=buf, dtype=fbc_session_info_dtype)
10034 obj._data = data.view(_numpy.recarray)
10036 return obj
10039cdef _get_conf_compute_system_caps_dtype_offsets():
10040 cdef nvmlConfComputeSystemCaps_t pod = nvmlConfComputeSystemCaps_t()
10041 return _numpy.dtype({
10042 'names': ['cpu_caps', 'gpus_caps'],
10043 'formats': [_numpy.uint32, _numpy.uint32],
10044 'offsets': [
10045 (<intptr_t>&(pod.cpuCaps)) - (<intptr_t>&pod),
10046 (<intptr_t>&(pod.gpusCaps)) - (<intptr_t>&pod),
10047 ],
10048 'itemsize': sizeof(nvmlConfComputeSystemCaps_t),
10049 })
10051conf_compute_system_caps_dtype = _get_conf_compute_system_caps_dtype_offsets()
10053cdef class ConfComputeSystemCaps:
10054 """Empty-initialize an instance of `nvmlConfComputeSystemCaps_t`.
10057 .. seealso:: `nvmlConfComputeSystemCaps_t`
10058 """
10059 cdef:
10060 nvmlConfComputeSystemCaps_t *_ptr
10061 object _owner
10062 bint _owned
10063 bint _readonly
10065 def __init__(self):
10066 self._ptr = <nvmlConfComputeSystemCaps_t *>calloc(1, sizeof(nvmlConfComputeSystemCaps_t))
10067 if self._ptr == NULL:
10068 raise MemoryError("Error allocating ConfComputeSystemCaps")
10069 self._owner = None
10070 self._owned = True
10071 self._readonly = False
10073 def __dealloc__(self):
10074 cdef nvmlConfComputeSystemCaps_t *ptr
10075 if self._owned and self._ptr != NULL:
10076 ptr = self._ptr
10077 self._ptr = NULL
10078 free(ptr)
10080 def __repr__(self):
10081 return f"<{__name__}.ConfComputeSystemCaps object at {hex(id(self))}>"
10083 @property
10084 def ptr(self):
10085 """Get the pointer address to the data as Python :class:`int`."""
10086 return <intptr_t>(self._ptr)
10088 cdef intptr_t _get_ptr(self):
10089 return <intptr_t>(self._ptr)
10091 def __int__(self):
10092 return <intptr_t>(self._ptr)
10094 def __eq__(self, other):
10095 cdef ConfComputeSystemCaps other_
10096 if not isinstance(other, ConfComputeSystemCaps):
10097 return False
10098 other_ = other
10099 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlConfComputeSystemCaps_t)) == 0)
10101 def __setitem__(self, key, val):
10102 if key == 0 and isinstance(val, _numpy.ndarray):
10103 self._ptr = <nvmlConfComputeSystemCaps_t *>malloc(sizeof(nvmlConfComputeSystemCaps_t))
10104 if self._ptr == NULL:
10105 raise MemoryError("Error allocating ConfComputeSystemCaps")
10106 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlConfComputeSystemCaps_t))
10107 self._owner = None
10108 self._owned = True
10109 self._readonly = not val.flags.writeable
10110 else:
10111 setattr(self, key, val)
10113 @property
10114 def cpu_caps(self):
10115 """int: """
10116 return self._ptr[0].cpuCaps
10118 @cpu_caps.setter
10119 def cpu_caps(self, val):
10120 if self._readonly:
10121 raise ValueError("This ConfComputeSystemCaps instance is read-only")
10122 self._ptr[0].cpuCaps = val
10124 @property
10125 def gpus_caps(self):
10126 """int: """
10127 return self._ptr[0].gpusCaps
10129 @gpus_caps.setter
10130 def gpus_caps(self, val):
10131 if self._readonly:
10132 raise ValueError("This ConfComputeSystemCaps instance is read-only")
10133 self._ptr[0].gpusCaps = val
10135 @staticmethod
10136 def from_data(data):
10137 """Create an ConfComputeSystemCaps instance wrapping the given NumPy array.
10139 Args:
10140 data (_numpy.ndarray): a single-element array of dtype `conf_compute_system_caps_dtype` holding the data.
10141 """
10142 return __from_data(data, "conf_compute_system_caps_dtype", conf_compute_system_caps_dtype, ConfComputeSystemCaps)
10144 @staticmethod
10145 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
10146 """Create an ConfComputeSystemCaps instance wrapping the given pointer.
10148 Args:
10149 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10150 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
10151 readonly (bool): whether the data is read-only (to the user). default is `False`.
10152 """
10153 if ptr == 0:
10154 raise ValueError("ptr must not be null (0)")
10155 cdef ConfComputeSystemCaps obj = ConfComputeSystemCaps.__new__(ConfComputeSystemCaps)
10156 if owner is None:
10157 obj._ptr = <nvmlConfComputeSystemCaps_t *>malloc(sizeof(nvmlConfComputeSystemCaps_t))
10158 if obj._ptr == NULL:
10159 raise MemoryError("Error allocating ConfComputeSystemCaps")
10160 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlConfComputeSystemCaps_t))
10161 obj._owner = None
10162 obj._owned = True
10163 else:
10164 obj._ptr = <nvmlConfComputeSystemCaps_t *>ptr
10165 obj._owner = owner
10166 obj._owned = False
10167 obj._readonly = readonly
10168 return obj
10171cdef _get_conf_compute_system_state_dtype_offsets():
10172 cdef nvmlConfComputeSystemState_t pod = nvmlConfComputeSystemState_t()
10173 return _numpy.dtype({
10174 'names': ['environment', 'cc_feature', 'dev_tools_mode'],
10175 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32],
10176 'offsets': [
10177 (<intptr_t>&(pod.environment)) - (<intptr_t>&pod),
10178 (<intptr_t>&(pod.ccFeature)) - (<intptr_t>&pod),
10179 (<intptr_t>&(pod.devToolsMode)) - (<intptr_t>&pod),
10180 ],
10181 'itemsize': sizeof(nvmlConfComputeSystemState_t),
10182 })
10184conf_compute_system_state_dtype = _get_conf_compute_system_state_dtype_offsets()
10186cdef class ConfComputeSystemState:
10187 """Empty-initialize an instance of `nvmlConfComputeSystemState_t`.
10190 .. seealso:: `nvmlConfComputeSystemState_t`
10191 """
10192 cdef:
10193 nvmlConfComputeSystemState_t *_ptr
10194 object _owner
10195 bint _owned
10196 bint _readonly
10198 def __init__(self):
10199 self._ptr = <nvmlConfComputeSystemState_t *>calloc(1, sizeof(nvmlConfComputeSystemState_t))
10200 if self._ptr == NULL:
10201 raise MemoryError("Error allocating ConfComputeSystemState")
10202 self._owner = None
10203 self._owned = True
10204 self._readonly = False
10206 def __dealloc__(self):
10207 cdef nvmlConfComputeSystemState_t *ptr
10208 if self._owned and self._ptr != NULL:
10209 ptr = self._ptr
10210 self._ptr = NULL
10211 free(ptr)
10213 def __repr__(self):
10214 return f"<{__name__}.ConfComputeSystemState object at {hex(id(self))}>"
10216 @property
10217 def ptr(self):
10218 """Get the pointer address to the data as Python :class:`int`."""
10219 return <intptr_t>(self._ptr)
10221 cdef intptr_t _get_ptr(self):
10222 return <intptr_t>(self._ptr)
10224 def __int__(self):
10225 return <intptr_t>(self._ptr)
10227 def __eq__(self, other):
10228 cdef ConfComputeSystemState other_
10229 if not isinstance(other, ConfComputeSystemState):
10230 return False
10231 other_ = other
10232 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlConfComputeSystemState_t)) == 0)
10234 def __setitem__(self, key, val):
10235 if key == 0 and isinstance(val, _numpy.ndarray):
10236 self._ptr = <nvmlConfComputeSystemState_t *>malloc(sizeof(nvmlConfComputeSystemState_t))
10237 if self._ptr == NULL:
10238 raise MemoryError("Error allocating ConfComputeSystemState")
10239 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlConfComputeSystemState_t))
10240 self._owner = None
10241 self._owned = True
10242 self._readonly = not val.flags.writeable
10243 else:
10244 setattr(self, key, val)
10246 @property
10247 def environment(self):
10248 """int: """
10249 return self._ptr[0].environment
10251 @environment.setter
10252 def environment(self, val):
10253 if self._readonly:
10254 raise ValueError("This ConfComputeSystemState instance is read-only")
10255 self._ptr[0].environment = val
10257 @property
10258 def cc_feature(self):
10259 """int: """
10260 return self._ptr[0].ccFeature
10262 @cc_feature.setter
10263 def cc_feature(self, val):
10264 if self._readonly:
10265 raise ValueError("This ConfComputeSystemState instance is read-only")
10266 self._ptr[0].ccFeature = val
10268 @property
10269 def dev_tools_mode(self):
10270 """int: """
10271 return self._ptr[0].devToolsMode
10273 @dev_tools_mode.setter
10274 def dev_tools_mode(self, val):
10275 if self._readonly:
10276 raise ValueError("This ConfComputeSystemState instance is read-only")
10277 self._ptr[0].devToolsMode = val
10279 @staticmethod
10280 def from_data(data):
10281 """Create an ConfComputeSystemState instance wrapping the given NumPy array.
10283 Args:
10284 data (_numpy.ndarray): a single-element array of dtype `conf_compute_system_state_dtype` holding the data.
10285 """
10286 return __from_data(data, "conf_compute_system_state_dtype", conf_compute_system_state_dtype, ConfComputeSystemState)
10288 @staticmethod
10289 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
10290 """Create an ConfComputeSystemState instance wrapping the given pointer.
10292 Args:
10293 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10294 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
10295 readonly (bool): whether the data is read-only (to the user). default is `False`.
10296 """
10297 if ptr == 0:
10298 raise ValueError("ptr must not be null (0)")
10299 cdef ConfComputeSystemState obj = ConfComputeSystemState.__new__(ConfComputeSystemState)
10300 if owner is None:
10301 obj._ptr = <nvmlConfComputeSystemState_t *>malloc(sizeof(nvmlConfComputeSystemState_t))
10302 if obj._ptr == NULL:
10303 raise MemoryError("Error allocating ConfComputeSystemState")
10304 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlConfComputeSystemState_t))
10305 obj._owner = None
10306 obj._owned = True
10307 else:
10308 obj._ptr = <nvmlConfComputeSystemState_t *>ptr
10309 obj._owner = owner
10310 obj._owned = False
10311 obj._readonly = readonly
10312 return obj
10315cdef _get_system_conf_compute_settings_v1_dtype_offsets():
10316 cdef nvmlSystemConfComputeSettings_v1_t pod = nvmlSystemConfComputeSettings_v1_t()
10317 return _numpy.dtype({
10318 'names': ['version', 'environment', 'cc_feature', 'dev_tools_mode', 'multi_gpu_mode'],
10319 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
10320 'offsets': [
10321 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
10322 (<intptr_t>&(pod.environment)) - (<intptr_t>&pod),
10323 (<intptr_t>&(pod.ccFeature)) - (<intptr_t>&pod),
10324 (<intptr_t>&(pod.devToolsMode)) - (<intptr_t>&pod),
10325 (<intptr_t>&(pod.multiGpuMode)) - (<intptr_t>&pod),
10326 ],
10327 'itemsize': sizeof(nvmlSystemConfComputeSettings_v1_t),
10328 })
10330system_conf_compute_settings_v1_dtype = _get_system_conf_compute_settings_v1_dtype_offsets()
10332cdef class SystemConfComputeSettings_v1:
10333 """Empty-initialize an instance of `nvmlSystemConfComputeSettings_v1_t`.
10336 .. seealso:: `nvmlSystemConfComputeSettings_v1_t`
10337 """
10338 cdef:
10339 nvmlSystemConfComputeSettings_v1_t *_ptr
10340 object _owner
10341 bint _owned
10342 bint _readonly
10344 def __init__(self):
10345 self._ptr = <nvmlSystemConfComputeSettings_v1_t *>calloc(1, sizeof(nvmlSystemConfComputeSettings_v1_t))
10346 if self._ptr == NULL:
10347 raise MemoryError("Error allocating SystemConfComputeSettings_v1")
10348 self._owner = None
10349 self._owned = True
10350 self._readonly = False
10352 def __dealloc__(self):
10353 cdef nvmlSystemConfComputeSettings_v1_t *ptr
10354 if self._owned and self._ptr != NULL:
10355 ptr = self._ptr
10356 self._ptr = NULL
10357 free(ptr)
10359 def __repr__(self):
10360 return f"<{__name__}.SystemConfComputeSettings_v1 object at {hex(id(self))}>"
10362 @property
10363 def ptr(self):
10364 """Get the pointer address to the data as Python :class:`int`."""
10365 return <intptr_t>(self._ptr)
10367 cdef intptr_t _get_ptr(self):
10368 return <intptr_t>(self._ptr)
10370 def __int__(self):
10371 return <intptr_t>(self._ptr)
10373 def __eq__(self, other):
10374 cdef SystemConfComputeSettings_v1 other_
10375 if not isinstance(other, SystemConfComputeSettings_v1):
10376 return False
10377 other_ = other
10378 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlSystemConfComputeSettings_v1_t)) == 0)
10380 def __setitem__(self, key, val):
10381 if key == 0 and isinstance(val, _numpy.ndarray):
10382 self._ptr = <nvmlSystemConfComputeSettings_v1_t *>malloc(sizeof(nvmlSystemConfComputeSettings_v1_t))
10383 if self._ptr == NULL:
10384 raise MemoryError("Error allocating SystemConfComputeSettings_v1")
10385 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlSystemConfComputeSettings_v1_t))
10386 self._owner = None
10387 self._owned = True
10388 self._readonly = not val.flags.writeable
10389 else:
10390 setattr(self, key, val)
10392 @property
10393 def version(self):
10394 """int: """
10395 return self._ptr[0].version
10397 @version.setter
10398 def version(self, val):
10399 if self._readonly:
10400 raise ValueError("This SystemConfComputeSettings_v1 instance is read-only")
10401 self._ptr[0].version = val
10403 @property
10404 def environment(self):
10405 """int: """
10406 return self._ptr[0].environment
10408 @environment.setter
10409 def environment(self, val):
10410 if self._readonly:
10411 raise ValueError("This SystemConfComputeSettings_v1 instance is read-only")
10412 self._ptr[0].environment = val
10414 @property
10415 def cc_feature(self):
10416 """int: """
10417 return self._ptr[0].ccFeature
10419 @cc_feature.setter
10420 def cc_feature(self, val):
10421 if self._readonly:
10422 raise ValueError("This SystemConfComputeSettings_v1 instance is read-only")
10423 self._ptr[0].ccFeature = val
10425 @property
10426 def dev_tools_mode(self):
10427 """int: """
10428 return self._ptr[0].devToolsMode
10430 @dev_tools_mode.setter
10431 def dev_tools_mode(self, val):
10432 if self._readonly:
10433 raise ValueError("This SystemConfComputeSettings_v1 instance is read-only")
10434 self._ptr[0].devToolsMode = val
10436 @property
10437 def multi_gpu_mode(self):
10438 """int: """
10439 return self._ptr[0].multiGpuMode
10441 @multi_gpu_mode.setter
10442 def multi_gpu_mode(self, val):
10443 if self._readonly:
10444 raise ValueError("This SystemConfComputeSettings_v1 instance is read-only")
10445 self._ptr[0].multiGpuMode = val
10447 @staticmethod
10448 def from_data(data):
10449 """Create an SystemConfComputeSettings_v1 instance wrapping the given NumPy array.
10451 Args:
10452 data (_numpy.ndarray): a single-element array of dtype `system_conf_compute_settings_v1_dtype` holding the data.
10453 """
10454 return __from_data(data, "system_conf_compute_settings_v1_dtype", system_conf_compute_settings_v1_dtype, SystemConfComputeSettings_v1)
10456 @staticmethod
10457 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
10458 """Create an SystemConfComputeSettings_v1 instance wrapping the given pointer.
10460 Args:
10461 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10462 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
10463 readonly (bool): whether the data is read-only (to the user). default is `False`.
10464 """
10465 if ptr == 0:
10466 raise ValueError("ptr must not be null (0)")
10467 cdef SystemConfComputeSettings_v1 obj = SystemConfComputeSettings_v1.__new__(SystemConfComputeSettings_v1)
10468 if owner is None:
10469 obj._ptr = <nvmlSystemConfComputeSettings_v1_t *>malloc(sizeof(nvmlSystemConfComputeSettings_v1_t))
10470 if obj._ptr == NULL:
10471 raise MemoryError("Error allocating SystemConfComputeSettings_v1")
10472 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlSystemConfComputeSettings_v1_t))
10473 obj._owner = None
10474 obj._owned = True
10475 else:
10476 obj._ptr = <nvmlSystemConfComputeSettings_v1_t *>ptr
10477 obj._owner = owner
10478 obj._owned = False
10479 obj._readonly = readonly
10480 return obj
10483cdef _get_conf_compute_mem_size_info_dtype_offsets():
10484 cdef nvmlConfComputeMemSizeInfo_t pod = nvmlConfComputeMemSizeInfo_t()
10485 return _numpy.dtype({
10486 'names': ['protected_mem_size_kib', 'unprotected_mem_size_kib'],
10487 'formats': [_numpy.uint64, _numpy.uint64],
10488 'offsets': [
10489 (<intptr_t>&(pod.protectedMemSizeKib)) - (<intptr_t>&pod),
10490 (<intptr_t>&(pod.unprotectedMemSizeKib)) - (<intptr_t>&pod),
10491 ],
10492 'itemsize': sizeof(nvmlConfComputeMemSizeInfo_t),
10493 })
10495conf_compute_mem_size_info_dtype = _get_conf_compute_mem_size_info_dtype_offsets()
10497cdef class ConfComputeMemSizeInfo:
10498 """Empty-initialize an instance of `nvmlConfComputeMemSizeInfo_t`.
10501 .. seealso:: `nvmlConfComputeMemSizeInfo_t`
10502 """
10503 cdef:
10504 nvmlConfComputeMemSizeInfo_t *_ptr
10505 object _owner
10506 bint _owned
10507 bint _readonly
10509 def __init__(self):
10510 self._ptr = <nvmlConfComputeMemSizeInfo_t *>calloc(1, sizeof(nvmlConfComputeMemSizeInfo_t))
10511 if self._ptr == NULL:
10512 raise MemoryError("Error allocating ConfComputeMemSizeInfo")
10513 self._owner = None
10514 self._owned = True
10515 self._readonly = False
10517 def __dealloc__(self):
10518 cdef nvmlConfComputeMemSizeInfo_t *ptr
10519 if self._owned and self._ptr != NULL:
10520 ptr = self._ptr
10521 self._ptr = NULL
10522 free(ptr)
10524 def __repr__(self):
10525 return f"<{__name__}.ConfComputeMemSizeInfo object at {hex(id(self))}>"
10527 @property
10528 def ptr(self):
10529 """Get the pointer address to the data as Python :class:`int`."""
10530 return <intptr_t>(self._ptr)
10532 cdef intptr_t _get_ptr(self):
10533 return <intptr_t>(self._ptr)
10535 def __int__(self):
10536 return <intptr_t>(self._ptr)
10538 def __eq__(self, other):
10539 cdef ConfComputeMemSizeInfo other_
10540 if not isinstance(other, ConfComputeMemSizeInfo):
10541 return False
10542 other_ = other
10543 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlConfComputeMemSizeInfo_t)) == 0)
10545 def __setitem__(self, key, val):
10546 if key == 0 and isinstance(val, _numpy.ndarray):
10547 self._ptr = <nvmlConfComputeMemSizeInfo_t *>malloc(sizeof(nvmlConfComputeMemSizeInfo_t))
10548 if self._ptr == NULL:
10549 raise MemoryError("Error allocating ConfComputeMemSizeInfo")
10550 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlConfComputeMemSizeInfo_t))
10551 self._owner = None
10552 self._owned = True
10553 self._readonly = not val.flags.writeable
10554 else:
10555 setattr(self, key, val)
10557 @property
10558 def protected_mem_size_kib(self):
10559 """int: """
10560 return self._ptr[0].protectedMemSizeKib
10562 @protected_mem_size_kib.setter
10563 def protected_mem_size_kib(self, val):
10564 if self._readonly:
10565 raise ValueError("This ConfComputeMemSizeInfo instance is read-only")
10566 self._ptr[0].protectedMemSizeKib = val
10568 @property
10569 def unprotected_mem_size_kib(self):
10570 """int: """
10571 return self._ptr[0].unprotectedMemSizeKib
10573 @unprotected_mem_size_kib.setter
10574 def unprotected_mem_size_kib(self, val):
10575 if self._readonly:
10576 raise ValueError("This ConfComputeMemSizeInfo instance is read-only")
10577 self._ptr[0].unprotectedMemSizeKib = val
10579 @staticmethod
10580 def from_data(data):
10581 """Create an ConfComputeMemSizeInfo instance wrapping the given NumPy array.
10583 Args:
10584 data (_numpy.ndarray): a single-element array of dtype `conf_compute_mem_size_info_dtype` holding the data.
10585 """
10586 return __from_data(data, "conf_compute_mem_size_info_dtype", conf_compute_mem_size_info_dtype, ConfComputeMemSizeInfo)
10588 @staticmethod
10589 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
10590 """Create an ConfComputeMemSizeInfo instance wrapping the given pointer.
10592 Args:
10593 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10594 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
10595 readonly (bool): whether the data is read-only (to the user). default is `False`.
10596 """
10597 if ptr == 0:
10598 raise ValueError("ptr must not be null (0)")
10599 cdef ConfComputeMemSizeInfo obj = ConfComputeMemSizeInfo.__new__(ConfComputeMemSizeInfo)
10600 if owner is None:
10601 obj._ptr = <nvmlConfComputeMemSizeInfo_t *>malloc(sizeof(nvmlConfComputeMemSizeInfo_t))
10602 if obj._ptr == NULL:
10603 raise MemoryError("Error allocating ConfComputeMemSizeInfo")
10604 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlConfComputeMemSizeInfo_t))
10605 obj._owner = None
10606 obj._owned = True
10607 else:
10608 obj._ptr = <nvmlConfComputeMemSizeInfo_t *>ptr
10609 obj._owner = owner
10610 obj._owned = False
10611 obj._readonly = readonly
10612 return obj
10615cdef _get_conf_compute_gpu_certificate_dtype_offsets():
10616 cdef nvmlConfComputeGpuCertificate_t pod = nvmlConfComputeGpuCertificate_t()
10617 return _numpy.dtype({
10618 'names': ['cert_chain_size', 'attestation_cert_chain_size', 'cert_chain', 'attestation_cert_chain'],
10619 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.uint8, 4096), (_numpy.uint8, 5120)],
10620 'offsets': [
10621 (<intptr_t>&(pod.certChainSize)) - (<intptr_t>&pod),
10622 (<intptr_t>&(pod.attestationCertChainSize)) - (<intptr_t>&pod),
10623 (<intptr_t>&(pod.certChain)) - (<intptr_t>&pod),
10624 (<intptr_t>&(pod.attestationCertChain)) - (<intptr_t>&pod),
10625 ],
10626 'itemsize': sizeof(nvmlConfComputeGpuCertificate_t),
10627 })
10629conf_compute_gpu_certificate_dtype = _get_conf_compute_gpu_certificate_dtype_offsets()
10631cdef class ConfComputeGpuCertificate:
10632 """Empty-initialize an instance of `nvmlConfComputeGpuCertificate_t`.
10635 .. seealso:: `nvmlConfComputeGpuCertificate_t`
10636 """
10637 cdef:
10638 nvmlConfComputeGpuCertificate_t *_ptr
10639 object _owner
10640 bint _owned
10641 bint _readonly
10643 def __init__(self):
10644 self._ptr = <nvmlConfComputeGpuCertificate_t *>calloc(1, sizeof(nvmlConfComputeGpuCertificate_t)) 2mbC
10645 if self._ptr == NULL: 2mbC
10646 raise MemoryError("Error allocating ConfComputeGpuCertificate")
10647 self._owner = None 2mbC
10648 self._owned = True 2mbC
10649 self._readonly = False 2mbC
10651 def __dealloc__(self):
10652 cdef nvmlConfComputeGpuCertificate_t *ptr
10653 if self._owned and self._ptr != NULL: 2mbC
10654 ptr = self._ptr 2mbC
10655 self._ptr = NULL 2mbC
10656 free(ptr) 2mbC
10658 def __repr__(self):
10659 return f"<{__name__}.ConfComputeGpuCertificate object at {hex(id(self))}>"
10661 @property
10662 def ptr(self):
10663 """Get the pointer address to the data as Python :class:`int`."""
10664 return <intptr_t>(self._ptr)
10666 cdef intptr_t _get_ptr(self):
10667 return <intptr_t>(self._ptr) 1C
10669 def __int__(self):
10670 return <intptr_t>(self._ptr)
10672 def __eq__(self, other):
10673 cdef ConfComputeGpuCertificate other_
10674 if not isinstance(other, ConfComputeGpuCertificate):
10675 return False
10676 other_ = other
10677 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlConfComputeGpuCertificate_t)) == 0)
10679 def __setitem__(self, key, val):
10680 if key == 0 and isinstance(val, _numpy.ndarray):
10681 self._ptr = <nvmlConfComputeGpuCertificate_t *>malloc(sizeof(nvmlConfComputeGpuCertificate_t))
10682 if self._ptr == NULL:
10683 raise MemoryError("Error allocating ConfComputeGpuCertificate")
10684 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlConfComputeGpuCertificate_t))
10685 self._owner = None
10686 self._owned = True
10687 self._readonly = not val.flags.writeable
10688 else:
10689 setattr(self, key, val)
10691 @property
10692 def cert_chain(self):
10693 """~_numpy.uint8: (array of length 4096)."""
10694 if self._ptr[0].certChainSize == 0: 2mb
10695 return _numpy.array([]) 2mb
10696 cdef view.array arr = view.array(shape=(self._ptr[0].certChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
10697 arr.data = <char *>(&(self._ptr[0].certChain))
10698 return _numpy.asarray(arr)
10700 @cert_chain.setter
10701 def cert_chain(self, val):
10702 if self._readonly:
10703 raise ValueError("This ConfComputeGpuCertificate instance is read-only")
10704 if len(val) > 4096:
10705 raise ValueError(f"Too many elements for field cert_chain, max is 4096, got {len(val)}")
10706 self._ptr[0].certChainSize = len(val)
10707 if len(val) == 0:
10708 return
10709 cdef view.array arr = view.array(shape=(self._ptr[0].certChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c")
10710 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
10711 memcpy(<void *>(&(self._ptr[0].certChain)), <void *>(arr.data), sizeof(unsigned char) * len(val))
10713 @property
10714 def attestation_cert_chain(self):
10715 """~_numpy.uint8: (array of length 5120)."""
10716 if self._ptr[0].attestationCertChainSize == 0: 2mb
10717 return _numpy.array([]) 2mb
10718 cdef view.array arr = view.array(shape=(self._ptr[0].attestationCertChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
10719 arr.data = <char *>(&(self._ptr[0].attestationCertChain))
10720 return _numpy.asarray(arr)
10722 @attestation_cert_chain.setter
10723 def attestation_cert_chain(self, val):
10724 if self._readonly:
10725 raise ValueError("This ConfComputeGpuCertificate instance is read-only")
10726 if len(val) > 5120:
10727 raise ValueError(f"Too many elements for field attestation_cert_chain, max is 5120, got {len(val)}")
10728 self._ptr[0].attestationCertChainSize = len(val)
10729 if len(val) == 0:
10730 return
10731 cdef view.array arr = view.array(shape=(self._ptr[0].attestationCertChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c")
10732 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
10733 memcpy(<void *>(&(self._ptr[0].attestationCertChain)), <void *>(arr.data), sizeof(unsigned char) * len(val))
10735 @staticmethod
10736 def from_data(data):
10737 """Create an ConfComputeGpuCertificate instance wrapping the given NumPy array.
10739 Args:
10740 data (_numpy.ndarray): a single-element array of dtype `conf_compute_gpu_certificate_dtype` holding the data.
10741 """
10742 return __from_data(data, "conf_compute_gpu_certificate_dtype", conf_compute_gpu_certificate_dtype, ConfComputeGpuCertificate)
10744 @staticmethod
10745 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
10746 """Create an ConfComputeGpuCertificate instance wrapping the given pointer.
10748 Args:
10749 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10750 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
10751 readonly (bool): whether the data is read-only (to the user). default is `False`.
10752 """
10753 if ptr == 0:
10754 raise ValueError("ptr must not be null (0)")
10755 cdef ConfComputeGpuCertificate obj = ConfComputeGpuCertificate.__new__(ConfComputeGpuCertificate)
10756 if owner is None:
10757 obj._ptr = <nvmlConfComputeGpuCertificate_t *>malloc(sizeof(nvmlConfComputeGpuCertificate_t))
10758 if obj._ptr == NULL:
10759 raise MemoryError("Error allocating ConfComputeGpuCertificate")
10760 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlConfComputeGpuCertificate_t))
10761 obj._owner = None
10762 obj._owned = True
10763 else:
10764 obj._ptr = <nvmlConfComputeGpuCertificate_t *>ptr
10765 obj._owner = owner
10766 obj._owned = False
10767 obj._readonly = readonly
10768 return obj
10771cdef _get_conf_compute_gpu_attestation_report_dtype_offsets():
10772 cdef nvmlConfComputeGpuAttestationReport_t pod = nvmlConfComputeGpuAttestationReport_t()
10773 return _numpy.dtype({
10774 'names': ['is_cec_attestation_report_present', 'attestation_report_size', 'cec_attestation_report_size', 'nonce', 'attestation_report', 'cec_attestation_report'],
10775 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.uint8, 32), (_numpy.uint8, 8192), (_numpy.uint8, 4096)],
10776 'offsets': [
10777 (<intptr_t>&(pod.isCecAttestationReportPresent)) - (<intptr_t>&pod),
10778 (<intptr_t>&(pod.attestationReportSize)) - (<intptr_t>&pod),
10779 (<intptr_t>&(pod.cecAttestationReportSize)) - (<intptr_t>&pod),
10780 (<intptr_t>&(pod.nonce)) - (<intptr_t>&pod),
10781 (<intptr_t>&(pod.attestationReport)) - (<intptr_t>&pod),
10782 (<intptr_t>&(pod.cecAttestationReport)) - (<intptr_t>&pod),
10783 ],
10784 'itemsize': sizeof(nvmlConfComputeGpuAttestationReport_t),
10785 })
10787conf_compute_gpu_attestation_report_dtype = _get_conf_compute_gpu_attestation_report_dtype_offsets()
10789cdef class ConfComputeGpuAttestationReport:
10790 """Empty-initialize an instance of `nvmlConfComputeGpuAttestationReport_t`.
10793 .. seealso:: `nvmlConfComputeGpuAttestationReport_t`
10794 """
10795 cdef:
10796 nvmlConfComputeGpuAttestationReport_t *_ptr
10797 object _owner
10798 bint _owned
10799 bint _readonly
10801 def __init__(self):
10802 self._ptr = <nvmlConfComputeGpuAttestationReport_t *>calloc(1, sizeof(nvmlConfComputeGpuAttestationReport_t)) 1#z
10803 if self._ptr == NULL: 1#z
10804 raise MemoryError("Error allocating ConfComputeGpuAttestationReport")
10805 self._owner = None 1#z
10806 self._owned = True 1#z
10807 self._readonly = False 1#z
10809 def __dealloc__(self):
10810 cdef nvmlConfComputeGpuAttestationReport_t *ptr
10811 if self._owned and self._ptr != NULL: 1#z
10812 ptr = self._ptr 1#z
10813 self._ptr = NULL 1#z
10814 free(ptr) 1#z
10816 def __repr__(self):
10817 return f"<{__name__}.ConfComputeGpuAttestationReport object at {hex(id(self))}>"
10819 @property
10820 def ptr(self):
10821 """Get the pointer address to the data as Python :class:`int`."""
10822 return <intptr_t>(self._ptr)
10824 cdef intptr_t _get_ptr(self):
10825 return <intptr_t>(self._ptr) 1z
10827 def __int__(self):
10828 return <intptr_t>(self._ptr)
10830 def __eq__(self, other):
10831 cdef ConfComputeGpuAttestationReport other_
10832 if not isinstance(other, ConfComputeGpuAttestationReport):
10833 return False
10834 other_ = other
10835 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlConfComputeGpuAttestationReport_t)) == 0)
10837 def __setitem__(self, key, val):
10838 if key == 0 and isinstance(val, _numpy.ndarray):
10839 self._ptr = <nvmlConfComputeGpuAttestationReport_t *>malloc(sizeof(nvmlConfComputeGpuAttestationReport_t))
10840 if self._ptr == NULL:
10841 raise MemoryError("Error allocating ConfComputeGpuAttestationReport")
10842 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlConfComputeGpuAttestationReport_t))
10843 self._owner = None
10844 self._owned = True
10845 self._readonly = not val.flags.writeable
10846 else:
10847 setattr(self, key, val)
10849 @property
10850 def is_cec_attestation_report_present(self):
10851 """int: """
10852 return self._ptr[0].isCecAttestationReportPresent
10854 @is_cec_attestation_report_present.setter
10855 def is_cec_attestation_report_present(self, val):
10856 if self._readonly:
10857 raise ValueError("This ConfComputeGpuAttestationReport instance is read-only")
10858 self._ptr[0].isCecAttestationReportPresent = val
10860 @property
10861 def nonce(self):
10862 """~_numpy.uint8: (array of length 32)."""
10863 cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) 1#
10864 arr.data = <char *>(&(self._ptr[0].nonce)) 1#
10865 return _numpy.asarray(arr) 1#
10867 @nonce.setter
10868 def nonce(self, val):
10869 if self._readonly:
10870 raise ValueError("This ConfComputeGpuAttestationReport instance is read-only")
10871 if len(val) != 32:
10872 raise ValueError(f"Expected length { 32 } for field nonce, got {len(val)}")
10873 cdef view.array arr = view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c")
10874 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
10875 memcpy(<void *>(&(self._ptr[0].nonce)), <void *>(arr.data), sizeof(unsigned char) * len(val))
10877 @property
10878 def attestation_report(self):
10879 """~_numpy.uint8: (array of length 8192)."""
10880 if self._ptr[0].attestationReportSize == 0: 1#
10881 return _numpy.array([]) 1#
10882 cdef view.array arr = view.array(shape=(self._ptr[0].attestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
10883 arr.data = <char *>(&(self._ptr[0].attestationReport))
10884 return _numpy.asarray(arr)
10886 @attestation_report.setter
10887 def attestation_report(self, val):
10888 if self._readonly:
10889 raise ValueError("This ConfComputeGpuAttestationReport instance is read-only")
10890 if len(val) > 8192:
10891 raise ValueError(f"Too many elements for field attestation_report, max is 8192, got {len(val)}")
10892 self._ptr[0].attestationReportSize = len(val)
10893 if len(val) == 0:
10894 return
10895 cdef view.array arr = view.array(shape=(self._ptr[0].attestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c")
10896 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
10897 memcpy(<void *>(&(self._ptr[0].attestationReport)), <void *>(arr.data), sizeof(unsigned char) * len(val))
10899 @property
10900 def cec_attestation_report(self):
10901 """~_numpy.uint8: (array of length 4096)."""
10902 if self._ptr[0].cecAttestationReportSize == 0: 1#
10903 return _numpy.array([]) 1#
10904 cdef view.array arr = view.array(shape=(self._ptr[0].cecAttestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
10905 arr.data = <char *>(&(self._ptr[0].cecAttestationReport))
10906 return _numpy.asarray(arr)
10908 @cec_attestation_report.setter
10909 def cec_attestation_report(self, val):
10910 if self._readonly:
10911 raise ValueError("This ConfComputeGpuAttestationReport instance is read-only")
10912 if len(val) > 4096:
10913 raise ValueError(f"Too many elements for field cec_attestation_report, max is 4096, got {len(val)}")
10914 self._ptr[0].cecAttestationReportSize = len(val)
10915 if len(val) == 0:
10916 return
10917 cdef view.array arr = view.array(shape=(self._ptr[0].cecAttestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c")
10918 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
10919 memcpy(<void *>(&(self._ptr[0].cecAttestationReport)), <void *>(arr.data), sizeof(unsigned char) * len(val))
10921 @staticmethod
10922 def from_data(data):
10923 """Create an ConfComputeGpuAttestationReport instance wrapping the given NumPy array.
10925 Args:
10926 data (_numpy.ndarray): a single-element array of dtype `conf_compute_gpu_attestation_report_dtype` holding the data.
10927 """
10928 return __from_data(data, "conf_compute_gpu_attestation_report_dtype", conf_compute_gpu_attestation_report_dtype, ConfComputeGpuAttestationReport)
10930 @staticmethod
10931 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
10932 """Create an ConfComputeGpuAttestationReport instance wrapping the given pointer.
10934 Args:
10935 ptr (intptr_t): pointer address as Python :class:`int` to the data.
10936 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
10937 readonly (bool): whether the data is read-only (to the user). default is `False`.
10938 """
10939 if ptr == 0:
10940 raise ValueError("ptr must not be null (0)")
10941 cdef ConfComputeGpuAttestationReport obj = ConfComputeGpuAttestationReport.__new__(ConfComputeGpuAttestationReport)
10942 if owner is None:
10943 obj._ptr = <nvmlConfComputeGpuAttestationReport_t *>malloc(sizeof(nvmlConfComputeGpuAttestationReport_t))
10944 if obj._ptr == NULL:
10945 raise MemoryError("Error allocating ConfComputeGpuAttestationReport")
10946 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlConfComputeGpuAttestationReport_t))
10947 obj._owner = None
10948 obj._owned = True
10949 else:
10950 obj._ptr = <nvmlConfComputeGpuAttestationReport_t *>ptr
10951 obj._owner = owner
10952 obj._owned = False
10953 obj._readonly = readonly
10954 return obj
10957cdef _get_gpu_fabric_info_v2_dtype_offsets():
10958 cdef nvmlGpuFabricInfo_v2_t pod = nvmlGpuFabricInfo_v2_t()
10959 return _numpy.dtype({
10960 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask'],
10961 'formats': [_numpy.uint32, (_numpy.uint8, 16), _numpy.int32, _numpy.uint32, _numpy.uint8, _numpy.uint32],
10962 'offsets': [
10963 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
10964 (<intptr_t>&(pod.clusterUuid)) - (<intptr_t>&pod),
10965 (<intptr_t>&(pod.status)) - (<intptr_t>&pod),
10966 (<intptr_t>&(pod.cliqueId)) - (<intptr_t>&pod),
10967 (<intptr_t>&(pod.state)) - (<intptr_t>&pod),
10968 (<intptr_t>&(pod.healthMask)) - (<intptr_t>&pod),
10969 ],
10970 'itemsize': sizeof(nvmlGpuFabricInfo_v2_t),
10971 })
10973gpu_fabric_info_v2_dtype = _get_gpu_fabric_info_v2_dtype_offsets()
10975cdef class GpuFabricInfo_v2:
10976 """Empty-initialize an instance of `nvmlGpuFabricInfo_v2_t`.
10979 .. seealso:: `nvmlGpuFabricInfo_v2_t`
10980 """
10981 cdef:
10982 nvmlGpuFabricInfo_v2_t *_ptr
10983 object _owner
10984 bint _owned
10985 bint _readonly
10987 def __init__(self):
10988 self._ptr = <nvmlGpuFabricInfo_v2_t *>calloc(1, sizeof(nvmlGpuFabricInfo_v2_t))
10989 if self._ptr == NULL:
10990 raise MemoryError("Error allocating GpuFabricInfo_v2")
10991 self._owner = None
10992 self._owned = True
10993 self._readonly = False
10995 def __dealloc__(self):
10996 cdef nvmlGpuFabricInfo_v2_t *ptr
10997 if self._owned and self._ptr != NULL:
10998 ptr = self._ptr
10999 self._ptr = NULL
11000 free(ptr)
11002 def __repr__(self):
11003 return f"<{__name__}.GpuFabricInfo_v2 object at {hex(id(self))}>"
11005 @property
11006 def ptr(self):
11007 """Get the pointer address to the data as Python :class:`int`."""
11008 return <intptr_t>(self._ptr)
11010 cdef intptr_t _get_ptr(self):
11011 return <intptr_t>(self._ptr)
11013 def __int__(self):
11014 return <intptr_t>(self._ptr)
11016 def __eq__(self, other):
11017 cdef GpuFabricInfo_v2 other_
11018 if not isinstance(other, GpuFabricInfo_v2):
11019 return False
11020 other_ = other
11021 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGpuFabricInfo_v2_t)) == 0)
11023 def __setitem__(self, key, val):
11024 if key == 0 and isinstance(val, _numpy.ndarray):
11025 self._ptr = <nvmlGpuFabricInfo_v2_t *>malloc(sizeof(nvmlGpuFabricInfo_v2_t))
11026 if self._ptr == NULL:
11027 raise MemoryError("Error allocating GpuFabricInfo_v2")
11028 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGpuFabricInfo_v2_t))
11029 self._owner = None
11030 self._owned = True
11031 self._readonly = not val.flags.writeable
11032 else:
11033 setattr(self, key, val)
11035 @property
11036 def version(self):
11037 """int: Structure version identifier (set to nvmlGpuFabricInfo_v2)"""
11038 return self._ptr[0].version
11040 @version.setter
11041 def version(self, val):
11042 if self._readonly:
11043 raise ValueError("This GpuFabricInfo_v2 instance is read-only")
11044 self._ptr[0].version = val
11046 @property
11047 def cluster_uuid(self):
11048 """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs."""
11049 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
11050 arr.data = <char *>(&(self._ptr[0].clusterUuid))
11051 return _numpy.asarray(arr)
11053 @cluster_uuid.setter
11054 def cluster_uuid(self, val):
11055 if self._readonly:
11056 raise ValueError("This GpuFabricInfo_v2 instance is read-only")
11057 if len(val) != 16:
11058 raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}")
11059 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c")
11060 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
11061 memcpy(<void *>(&(self._ptr[0].clusterUuid)), <void *>(arr.data), sizeof(unsigned char) * len(val))
11063 @property
11064 def status(self):
11065 """int: Probe Error status, if any. Must be checked only if Probe state returns "complete"."""
11066 return <int>(self._ptr[0].status)
11068 @status.setter
11069 def status(self, val):
11070 if self._readonly:
11071 raise ValueError("This GpuFabricInfo_v2 instance is read-only")
11072 self._ptr[0].status = <nvmlReturn_t><int>val
11074 @property
11075 def clique_id(self):
11076 """int: ID of the fabric clique to which this GPU belongs."""
11077 return self._ptr[0].cliqueId
11079 @clique_id.setter
11080 def clique_id(self, val):
11081 if self._readonly:
11082 raise ValueError("This GpuFabricInfo_v2 instance is read-only")
11083 self._ptr[0].cliqueId = val
11085 @property
11086 def state(self):
11087 """int: Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_*."""
11088 return <unsigned char>(self._ptr[0].state)
11090 @state.setter
11091 def state(self, val):
11092 if self._readonly:
11093 raise ValueError("This GpuFabricInfo_v2 instance is read-only")
11094 self._ptr[0].state = <nvmlGpuFabricState_t><unsigned char>val
11096 @property
11097 def health_mask(self):
11098 """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*."""
11099 return self._ptr[0].healthMask
11101 @health_mask.setter
11102 def health_mask(self, val):
11103 if self._readonly:
11104 raise ValueError("This GpuFabricInfo_v2 instance is read-only")
11105 self._ptr[0].healthMask = val
11107 @staticmethod
11108 def from_data(data):
11109 """Create an GpuFabricInfo_v2 instance wrapping the given NumPy array.
11111 Args:
11112 data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v2_dtype` holding the data.
11113 """
11114 return __from_data(data, "gpu_fabric_info_v2_dtype", gpu_fabric_info_v2_dtype, GpuFabricInfo_v2)
11116 @staticmethod
11117 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
11118 """Create an GpuFabricInfo_v2 instance wrapping the given pointer.
11120 Args:
11121 ptr (intptr_t): pointer address as Python :class:`int` to the data.
11122 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
11123 readonly (bool): whether the data is read-only (to the user). default is `False`.
11124 """
11125 if ptr == 0:
11126 raise ValueError("ptr must not be null (0)")
11127 cdef GpuFabricInfo_v2 obj = GpuFabricInfo_v2.__new__(GpuFabricInfo_v2)
11128 if owner is None:
11129 obj._ptr = <nvmlGpuFabricInfo_v2_t *>malloc(sizeof(nvmlGpuFabricInfo_v2_t))
11130 if obj._ptr == NULL:
11131 raise MemoryError("Error allocating GpuFabricInfo_v2")
11132 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGpuFabricInfo_v2_t))
11133 obj._owner = None
11134 obj._owned = True
11135 else:
11136 obj._ptr = <nvmlGpuFabricInfo_v2_t *>ptr
11137 obj._owner = owner
11138 obj._owned = False
11139 obj._readonly = readonly
11140 return obj
11143cdef _get_nvlink_supported_bw_modes_v1_dtype_offsets():
11144 cdef nvmlNvlinkSupportedBwModes_v1_t pod = nvmlNvlinkSupportedBwModes_v1_t()
11145 return _numpy.dtype({
11146 'names': ['version', 'bw_modes', 'total_bw_modes'],
11147 'formats': [_numpy.uint32, (_numpy.uint8, 23), _numpy.uint8],
11148 'offsets': [
11149 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
11150 (<intptr_t>&(pod.bwModes)) - (<intptr_t>&pod),
11151 (<intptr_t>&(pod.totalBwModes)) - (<intptr_t>&pod),
11152 ],
11153 'itemsize': sizeof(nvmlNvlinkSupportedBwModes_v1_t),
11154 })
11156nvlink_supported_bw_modes_v1_dtype = _get_nvlink_supported_bw_modes_v1_dtype_offsets()
11158cdef class NvlinkSupportedBwModes_v1:
11159 """Empty-initialize an instance of `nvmlNvlinkSupportedBwModes_v1_t`.
11162 .. seealso:: `nvmlNvlinkSupportedBwModes_v1_t`
11163 """
11164 cdef:
11165 nvmlNvlinkSupportedBwModes_v1_t *_ptr
11166 object _owner
11167 bint _owned
11168 bint _readonly
11170 def __init__(self):
11171 self._ptr = <nvmlNvlinkSupportedBwModes_v1_t *>calloc(1, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) 1p
11172 if self._ptr == NULL: 1p
11173 raise MemoryError("Error allocating NvlinkSupportedBwModes_v1")
11174 self._owner = None 1p
11175 self._owned = True 1p
11176 self._readonly = False 1p
11178 def __dealloc__(self):
11179 cdef nvmlNvlinkSupportedBwModes_v1_t *ptr
11180 if self._owned and self._ptr != NULL: 1p
11181 ptr = self._ptr 1p
11182 self._ptr = NULL 1p
11183 free(ptr) 1p
11185 def __repr__(self):
11186 return f"<{__name__}.NvlinkSupportedBwModes_v1 object at {hex(id(self))}>"
11188 @property
11189 def ptr(self):
11190 """Get the pointer address to the data as Python :class:`int`."""
11191 return <intptr_t>(self._ptr)
11193 cdef intptr_t _get_ptr(self):
11194 return <intptr_t>(self._ptr) 1p
11196 def __int__(self):
11197 return <intptr_t>(self._ptr)
11199 def __eq__(self, other):
11200 cdef NvlinkSupportedBwModes_v1 other_
11201 if not isinstance(other, NvlinkSupportedBwModes_v1):
11202 return False
11203 other_ = other
11204 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvlinkSupportedBwModes_v1_t)) == 0)
11206 def __setitem__(self, key, val):
11207 if key == 0 and isinstance(val, _numpy.ndarray):
11208 self._ptr = <nvmlNvlinkSupportedBwModes_v1_t *>malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t))
11209 if self._ptr == NULL:
11210 raise MemoryError("Error allocating NvlinkSupportedBwModes_v1")
11211 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvlinkSupportedBwModes_v1_t))
11212 self._owner = None
11213 self._owned = True
11214 self._readonly = not val.flags.writeable
11215 else:
11216 setattr(self, key, val)
11218 @property
11219 def version(self):
11220 """int: """
11221 return self._ptr[0].version
11223 @version.setter
11224 def version(self, val):
11225 if self._readonly:
11226 raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only")
11227 self._ptr[0].version = val
11229 @property
11230 def bw_modes(self):
11231 """~_numpy.uint8: (array of length 23)."""
11232 if self._ptr[0].totalBwModes == 0:
11233 return _numpy.array([])
11234 cdef view.array arr = view.array(shape=(self._ptr[0].totalBwModes,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
11235 arr.data = <char *>(&(self._ptr[0].bwModes))
11236 return _numpy.asarray(arr)
11238 @bw_modes.setter
11239 def bw_modes(self, val):
11240 if self._readonly:
11241 raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only")
11242 if len(val) > 23:
11243 raise ValueError(f"Too many elements for field bw_modes, max is 23, got {len(val)}")
11244 self._ptr[0].totalBwModes = len(val)
11245 if len(val) == 0:
11246 return
11247 cdef view.array arr = view.array(shape=(self._ptr[0].totalBwModes,), itemsize=sizeof(unsigned char), format="B", mode="c")
11248 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
11249 memcpy(<void *>(&(self._ptr[0].bwModes)), <void *>(arr.data), sizeof(unsigned char) * len(val))
11251 @staticmethod
11252 def from_data(data):
11253 """Create an NvlinkSupportedBwModes_v1 instance wrapping the given NumPy array.
11255 Args:
11256 data (_numpy.ndarray): a single-element array of dtype `nvlink_supported_bw_modes_v1_dtype` holding the data.
11257 """
11258 return __from_data(data, "nvlink_supported_bw_modes_v1_dtype", nvlink_supported_bw_modes_v1_dtype, NvlinkSupportedBwModes_v1)
11260 @staticmethod
11261 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
11262 """Create an NvlinkSupportedBwModes_v1 instance wrapping the given pointer.
11264 Args:
11265 ptr (intptr_t): pointer address as Python :class:`int` to the data.
11266 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
11267 readonly (bool): whether the data is read-only (to the user). default is `False`.
11268 """
11269 if ptr == 0:
11270 raise ValueError("ptr must not be null (0)")
11271 cdef NvlinkSupportedBwModes_v1 obj = NvlinkSupportedBwModes_v1.__new__(NvlinkSupportedBwModes_v1)
11272 if owner is None:
11273 obj._ptr = <nvmlNvlinkSupportedBwModes_v1_t *>malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t))
11274 if obj._ptr == NULL:
11275 raise MemoryError("Error allocating NvlinkSupportedBwModes_v1")
11276 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t))
11277 obj._owner = None
11278 obj._owned = True
11279 else:
11280 obj._ptr = <nvmlNvlinkSupportedBwModes_v1_t *>ptr
11281 obj._owner = owner
11282 obj._owned = False
11283 obj._readonly = readonly
11284 return obj
11287cdef _get_nvlink_get_bw_mode_v1_dtype_offsets():
11288 cdef nvmlNvlinkGetBwMode_v1_t pod = nvmlNvlinkGetBwMode_v1_t()
11289 return _numpy.dtype({
11290 'names': ['version', 'b_is_best', 'bw_mode'],
11291 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8],
11292 'offsets': [
11293 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
11294 (<intptr_t>&(pod.bIsBest)) - (<intptr_t>&pod),
11295 (<intptr_t>&(pod.bwMode)) - (<intptr_t>&pod),
11296 ],
11297 'itemsize': sizeof(nvmlNvlinkGetBwMode_v1_t),
11298 })
11300nvlink_get_bw_mode_v1_dtype = _get_nvlink_get_bw_mode_v1_dtype_offsets()
11302cdef class NvlinkGetBwMode_v1:
11303 """Empty-initialize an instance of `nvmlNvlinkGetBwMode_v1_t`.
11306 .. seealso:: `nvmlNvlinkGetBwMode_v1_t`
11307 """
11308 cdef:
11309 nvmlNvlinkGetBwMode_v1_t *_ptr
11310 object _owner
11311 bint _owned
11312 bint _readonly
11314 def __init__(self):
11315 self._ptr = <nvmlNvlinkGetBwMode_v1_t *>calloc(1, sizeof(nvmlNvlinkGetBwMode_v1_t))
11316 if self._ptr == NULL:
11317 raise MemoryError("Error allocating NvlinkGetBwMode_v1")
11318 self._owner = None
11319 self._owned = True
11320 self._readonly = False
11322 def __dealloc__(self):
11323 cdef nvmlNvlinkGetBwMode_v1_t *ptr
11324 if self._owned and self._ptr != NULL:
11325 ptr = self._ptr
11326 self._ptr = NULL
11327 free(ptr)
11329 def __repr__(self):
11330 return f"<{__name__}.NvlinkGetBwMode_v1 object at {hex(id(self))}>"
11332 @property
11333 def ptr(self):
11334 """Get the pointer address to the data as Python :class:`int`."""
11335 return <intptr_t>(self._ptr)
11337 cdef intptr_t _get_ptr(self):
11338 return <intptr_t>(self._ptr)
11340 def __int__(self):
11341 return <intptr_t>(self._ptr)
11343 def __eq__(self, other):
11344 cdef NvlinkGetBwMode_v1 other_
11345 if not isinstance(other, NvlinkGetBwMode_v1):
11346 return False
11347 other_ = other
11348 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvlinkGetBwMode_v1_t)) == 0)
11350 def __setitem__(self, key, val):
11351 if key == 0 and isinstance(val, _numpy.ndarray):
11352 self._ptr = <nvmlNvlinkGetBwMode_v1_t *>malloc(sizeof(nvmlNvlinkGetBwMode_v1_t))
11353 if self._ptr == NULL:
11354 raise MemoryError("Error allocating NvlinkGetBwMode_v1")
11355 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvlinkGetBwMode_v1_t))
11356 self._owner = None
11357 self._owned = True
11358 self._readonly = not val.flags.writeable
11359 else:
11360 setattr(self, key, val)
11362 @property
11363 def version(self):
11364 """int: """
11365 return self._ptr[0].version
11367 @version.setter
11368 def version(self, val):
11369 if self._readonly:
11370 raise ValueError("This NvlinkGetBwMode_v1 instance is read-only")
11371 self._ptr[0].version = val
11373 @property
11374 def b_is_best(self):
11375 """int: """
11376 return self._ptr[0].bIsBest
11378 @b_is_best.setter
11379 def b_is_best(self, val):
11380 if self._readonly:
11381 raise ValueError("This NvlinkGetBwMode_v1 instance is read-only")
11382 self._ptr[0].bIsBest = val
11384 @property
11385 def bw_mode(self):
11386 """int: """
11387 return self._ptr[0].bwMode
11389 @bw_mode.setter
11390 def bw_mode(self, val):
11391 if self._readonly:
11392 raise ValueError("This NvlinkGetBwMode_v1 instance is read-only")
11393 self._ptr[0].bwMode = val
11395 @staticmethod
11396 def from_data(data):
11397 """Create an NvlinkGetBwMode_v1 instance wrapping the given NumPy array.
11399 Args:
11400 data (_numpy.ndarray): a single-element array of dtype `nvlink_get_bw_mode_v1_dtype` holding the data.
11401 """
11402 return __from_data(data, "nvlink_get_bw_mode_v1_dtype", nvlink_get_bw_mode_v1_dtype, NvlinkGetBwMode_v1)
11404 @staticmethod
11405 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
11406 """Create an NvlinkGetBwMode_v1 instance wrapping the given pointer.
11408 Args:
11409 ptr (intptr_t): pointer address as Python :class:`int` to the data.
11410 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
11411 readonly (bool): whether the data is read-only (to the user). default is `False`.
11412 """
11413 if ptr == 0:
11414 raise ValueError("ptr must not be null (0)")
11415 cdef NvlinkGetBwMode_v1 obj = NvlinkGetBwMode_v1.__new__(NvlinkGetBwMode_v1)
11416 if owner is None:
11417 obj._ptr = <nvmlNvlinkGetBwMode_v1_t *>malloc(sizeof(nvmlNvlinkGetBwMode_v1_t))
11418 if obj._ptr == NULL:
11419 raise MemoryError("Error allocating NvlinkGetBwMode_v1")
11420 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvlinkGetBwMode_v1_t))
11421 obj._owner = None
11422 obj._owned = True
11423 else:
11424 obj._ptr = <nvmlNvlinkGetBwMode_v1_t *>ptr
11425 obj._owner = owner
11426 obj._owned = False
11427 obj._readonly = readonly
11428 return obj
11431cdef _get_nvlink_set_bw_mode_v1_dtype_offsets():
11432 cdef nvmlNvlinkSetBwMode_v1_t pod = nvmlNvlinkSetBwMode_v1_t()
11433 return _numpy.dtype({
11434 'names': ['version', 'b_set_best', 'bw_mode'],
11435 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8],
11436 'offsets': [
11437 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
11438 (<intptr_t>&(pod.bSetBest)) - (<intptr_t>&pod),
11439 (<intptr_t>&(pod.bwMode)) - (<intptr_t>&pod),
11440 ],
11441 'itemsize': sizeof(nvmlNvlinkSetBwMode_v1_t),
11442 })
11444nvlink_set_bw_mode_v1_dtype = _get_nvlink_set_bw_mode_v1_dtype_offsets()
11446cdef class NvlinkSetBwMode_v1:
11447 """Empty-initialize an instance of `nvmlNvlinkSetBwMode_v1_t`.
11450 .. seealso:: `nvmlNvlinkSetBwMode_v1_t`
11451 """
11452 cdef:
11453 nvmlNvlinkSetBwMode_v1_t *_ptr
11454 object _owner
11455 bint _owned
11456 bint _readonly
11458 def __init__(self):
11459 self._ptr = <nvmlNvlinkSetBwMode_v1_t *>calloc(1, sizeof(nvmlNvlinkSetBwMode_v1_t))
11460 if self._ptr == NULL:
11461 raise MemoryError("Error allocating NvlinkSetBwMode_v1")
11462 self._owner = None
11463 self._owned = True
11464 self._readonly = False
11466 def __dealloc__(self):
11467 cdef nvmlNvlinkSetBwMode_v1_t *ptr
11468 if self._owned and self._ptr != NULL:
11469 ptr = self._ptr
11470 self._ptr = NULL
11471 free(ptr)
11473 def __repr__(self):
11474 return f"<{__name__}.NvlinkSetBwMode_v1 object at {hex(id(self))}>"
11476 @property
11477 def ptr(self):
11478 """Get the pointer address to the data as Python :class:`int`."""
11479 return <intptr_t>(self._ptr)
11481 cdef intptr_t _get_ptr(self):
11482 return <intptr_t>(self._ptr)
11484 def __int__(self):
11485 return <intptr_t>(self._ptr)
11487 def __eq__(self, other):
11488 cdef NvlinkSetBwMode_v1 other_
11489 if not isinstance(other, NvlinkSetBwMode_v1):
11490 return False
11491 other_ = other
11492 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvlinkSetBwMode_v1_t)) == 0)
11494 def __setitem__(self, key, val):
11495 if key == 0 and isinstance(val, _numpy.ndarray):
11496 self._ptr = <nvmlNvlinkSetBwMode_v1_t *>malloc(sizeof(nvmlNvlinkSetBwMode_v1_t))
11497 if self._ptr == NULL:
11498 raise MemoryError("Error allocating NvlinkSetBwMode_v1")
11499 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvlinkSetBwMode_v1_t))
11500 self._owner = None
11501 self._owned = True
11502 self._readonly = not val.flags.writeable
11503 else:
11504 setattr(self, key, val)
11506 @property
11507 def version(self):
11508 """int: """
11509 return self._ptr[0].version
11511 @version.setter
11512 def version(self, val):
11513 if self._readonly:
11514 raise ValueError("This NvlinkSetBwMode_v1 instance is read-only")
11515 self._ptr[0].version = val
11517 @property
11518 def b_set_best(self):
11519 """int: """
11520 return self._ptr[0].bSetBest
11522 @b_set_best.setter
11523 def b_set_best(self, val):
11524 if self._readonly:
11525 raise ValueError("This NvlinkSetBwMode_v1 instance is read-only")
11526 self._ptr[0].bSetBest = val
11528 @property
11529 def bw_mode(self):
11530 """int: """
11531 return self._ptr[0].bwMode
11533 @bw_mode.setter
11534 def bw_mode(self, val):
11535 if self._readonly:
11536 raise ValueError("This NvlinkSetBwMode_v1 instance is read-only")
11537 self._ptr[0].bwMode = val
11539 @staticmethod
11540 def from_data(data):
11541 """Create an NvlinkSetBwMode_v1 instance wrapping the given NumPy array.
11543 Args:
11544 data (_numpy.ndarray): a single-element array of dtype `nvlink_set_bw_mode_v1_dtype` holding the data.
11545 """
11546 return __from_data(data, "nvlink_set_bw_mode_v1_dtype", nvlink_set_bw_mode_v1_dtype, NvlinkSetBwMode_v1)
11548 @staticmethod
11549 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
11550 """Create an NvlinkSetBwMode_v1 instance wrapping the given pointer.
11552 Args:
11553 ptr (intptr_t): pointer address as Python :class:`int` to the data.
11554 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
11555 readonly (bool): whether the data is read-only (to the user). default is `False`.
11556 """
11557 if ptr == 0:
11558 raise ValueError("ptr must not be null (0)")
11559 cdef NvlinkSetBwMode_v1 obj = NvlinkSetBwMode_v1.__new__(NvlinkSetBwMode_v1)
11560 if owner is None:
11561 obj._ptr = <nvmlNvlinkSetBwMode_v1_t *>malloc(sizeof(nvmlNvlinkSetBwMode_v1_t))
11562 if obj._ptr == NULL:
11563 raise MemoryError("Error allocating NvlinkSetBwMode_v1")
11564 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvlinkSetBwMode_v1_t))
11565 obj._owner = None
11566 obj._owned = True
11567 else:
11568 obj._ptr = <nvmlNvlinkSetBwMode_v1_t *>ptr
11569 obj._owner = owner
11570 obj._owned = False
11571 obj._readonly = readonly
11572 return obj
11575cdef _get_vgpu_version_dtype_offsets():
11576 cdef nvmlVgpuVersion_t pod = nvmlVgpuVersion_t()
11577 return _numpy.dtype({
11578 'names': ['min_version', 'max_version'],
11579 'formats': [_numpy.uint32, _numpy.uint32],
11580 'offsets': [
11581 (<intptr_t>&(pod.minVersion)) - (<intptr_t>&pod),
11582 (<intptr_t>&(pod.maxVersion)) - (<intptr_t>&pod),
11583 ],
11584 'itemsize': sizeof(nvmlVgpuVersion_t),
11585 })
11587vgpu_version_dtype = _get_vgpu_version_dtype_offsets()
11589cdef class VgpuVersion:
11590 """Empty-initialize an instance of `nvmlVgpuVersion_t`.
11593 .. seealso:: `nvmlVgpuVersion_t`
11594 """
11595 cdef:
11596 nvmlVgpuVersion_t *_ptr
11597 object _owner
11598 bint _owned
11599 bint _readonly
11601 def __init__(self):
11602 self._ptr = <nvmlVgpuVersion_t *>calloc(1, sizeof(nvmlVgpuVersion_t))
11603 if self._ptr == NULL:
11604 raise MemoryError("Error allocating VgpuVersion")
11605 self._owner = None
11606 self._owned = True
11607 self._readonly = False
11609 def __dealloc__(self):
11610 cdef nvmlVgpuVersion_t *ptr
11611 if self._owned and self._ptr != NULL:
11612 ptr = self._ptr
11613 self._ptr = NULL
11614 free(ptr)
11616 def __repr__(self):
11617 return f"<{__name__}.VgpuVersion object at {hex(id(self))}>"
11619 @property
11620 def ptr(self):
11621 """Get the pointer address to the data as Python :class:`int`."""
11622 return <intptr_t>(self._ptr)
11624 cdef intptr_t _get_ptr(self):
11625 return <intptr_t>(self._ptr)
11627 def __int__(self):
11628 return <intptr_t>(self._ptr)
11630 def __eq__(self, other):
11631 cdef VgpuVersion other_
11632 if not isinstance(other, VgpuVersion):
11633 return False
11634 other_ = other
11635 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuVersion_t)) == 0)
11637 def __setitem__(self, key, val):
11638 if key == 0 and isinstance(val, _numpy.ndarray):
11639 self._ptr = <nvmlVgpuVersion_t *>malloc(sizeof(nvmlVgpuVersion_t))
11640 if self._ptr == NULL:
11641 raise MemoryError("Error allocating VgpuVersion")
11642 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuVersion_t))
11643 self._owner = None
11644 self._owned = True
11645 self._readonly = not val.flags.writeable
11646 else:
11647 setattr(self, key, val)
11649 @property
11650 def min_version(self):
11651 """int: """
11652 return self._ptr[0].minVersion
11654 @min_version.setter
11655 def min_version(self, val):
11656 if self._readonly:
11657 raise ValueError("This VgpuVersion instance is read-only")
11658 self._ptr[0].minVersion = val
11660 @property
11661 def max_version(self):
11662 """int: """
11663 return self._ptr[0].maxVersion
11665 @max_version.setter
11666 def max_version(self, val):
11667 if self._readonly:
11668 raise ValueError("This VgpuVersion instance is read-only")
11669 self._ptr[0].maxVersion = val
11671 @staticmethod
11672 def from_data(data):
11673 """Create an VgpuVersion instance wrapping the given NumPy array.
11675 Args:
11676 data (_numpy.ndarray): a single-element array of dtype `vgpu_version_dtype` holding the data.
11677 """
11678 return __from_data(data, "vgpu_version_dtype", vgpu_version_dtype, VgpuVersion)
11680 @staticmethod
11681 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
11682 """Create an VgpuVersion instance wrapping the given pointer.
11684 Args:
11685 ptr (intptr_t): pointer address as Python :class:`int` to the data.
11686 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
11687 readonly (bool): whether the data is read-only (to the user). default is `False`.
11688 """
11689 if ptr == 0:
11690 raise ValueError("ptr must not be null (0)")
11691 cdef VgpuVersion obj = VgpuVersion.__new__(VgpuVersion)
11692 if owner is None:
11693 obj._ptr = <nvmlVgpuVersion_t *>malloc(sizeof(nvmlVgpuVersion_t))
11694 if obj._ptr == NULL:
11695 raise MemoryError("Error allocating VgpuVersion")
11696 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuVersion_t))
11697 obj._owner = None
11698 obj._owned = True
11699 else:
11700 obj._ptr = <nvmlVgpuVersion_t *>ptr
11701 obj._owner = owner
11702 obj._owned = False
11703 obj._readonly = readonly
11704 return obj
11707cdef _get_vgpu_metadata_dtype_offsets():
11708 cdef nvmlVgpuMetadata_t pod = nvmlVgpuMetadata_t()
11709 return _numpy.dtype({
11710 'names': ['version', 'revision', 'guest_info_state', 'guest_driver_version', 'host_driver_version', 'reserved', 'vgpu_virtualization_caps', 'guest_vgpu_version', 'opaque_data_size', 'opaque_data'],
11711 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int32, (_numpy.int8, 80), (_numpy.int8, 80), (_numpy.uint32, 6), _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 4)],
11712 'offsets': [
11713 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
11714 (<intptr_t>&(pod.revision)) - (<intptr_t>&pod),
11715 (<intptr_t>&(pod.guestInfoState)) - (<intptr_t>&pod),
11716 (<intptr_t>&(pod.guestDriverVersion)) - (<intptr_t>&pod),
11717 (<intptr_t>&(pod.hostDriverVersion)) - (<intptr_t>&pod),
11718 (<intptr_t>&(pod.reserved)) - (<intptr_t>&pod),
11719 (<intptr_t>&(pod.vgpuVirtualizationCaps)) - (<intptr_t>&pod),
11720 (<intptr_t>&(pod.guestVgpuVersion)) - (<intptr_t>&pod),
11721 (<intptr_t>&(pod.opaqueDataSize)) - (<intptr_t>&pod),
11722 (<intptr_t>&(pod.opaqueData)) - (<intptr_t>&pod),
11723 ],
11724 'itemsize': sizeof(nvmlVgpuMetadata_t),
11725 })
11727vgpu_metadata_dtype = _get_vgpu_metadata_dtype_offsets()
11729cdef class VgpuMetadata:
11730 """Empty-initialize an instance of `nvmlVgpuMetadata_t`.
11733 .. seealso:: `nvmlVgpuMetadata_t`
11734 """
11735 cdef:
11736 nvmlVgpuMetadata_t *_ptr
11737 object _owner
11738 bint _owned
11739 bint _readonly
11741 def __init__(self):
11742 self._ptr = <nvmlVgpuMetadata_t *>calloc(1, sizeof(nvmlVgpuMetadata_t))
11743 if self._ptr == NULL:
11744 raise MemoryError("Error allocating VgpuMetadata")
11745 self._owner = None
11746 self._owned = True
11747 self._readonly = False
11749 def __dealloc__(self):
11750 cdef nvmlVgpuMetadata_t *ptr
11751 if self._owned and self._ptr != NULL:
11752 ptr = self._ptr
11753 self._ptr = NULL
11754 free(ptr)
11756 def __repr__(self):
11757 return f"<{__name__}.VgpuMetadata object at {hex(id(self))}>"
11759 @property
11760 def ptr(self):
11761 """Get the pointer address to the data as Python :class:`int`."""
11762 return <intptr_t>(self._ptr)
11764 cdef intptr_t _get_ptr(self):
11765 return <intptr_t>(self._ptr)
11767 def __int__(self):
11768 return <intptr_t>(self._ptr)
11770 def __eq__(self, other):
11771 cdef VgpuMetadata other_
11772 if not isinstance(other, VgpuMetadata):
11773 return False
11774 other_ = other
11775 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuMetadata_t)) == 0)
11777 def __setitem__(self, key, val):
11778 if key == 0 and isinstance(val, _numpy.ndarray):
11779 self._ptr = <nvmlVgpuMetadata_t *>malloc(sizeof(nvmlVgpuMetadata_t))
11780 if self._ptr == NULL:
11781 raise MemoryError("Error allocating VgpuMetadata")
11782 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuMetadata_t))
11783 self._owner = None
11784 self._owned = True
11785 self._readonly = not val.flags.writeable
11786 else:
11787 setattr(self, key, val)
11789 @property
11790 def version(self):
11791 """int: """
11792 return self._ptr[0].version
11794 @version.setter
11795 def version(self, val):
11796 if self._readonly:
11797 raise ValueError("This VgpuMetadata instance is read-only")
11798 self._ptr[0].version = val
11800 @property
11801 def revision(self):
11802 """int: """
11803 return self._ptr[0].revision
11805 @revision.setter
11806 def revision(self, val):
11807 if self._readonly:
11808 raise ValueError("This VgpuMetadata instance is read-only")
11809 self._ptr[0].revision = val
11811 @property
11812 def guest_info_state(self):
11813 """int: """
11814 return <int>(self._ptr[0].guestInfoState)
11816 @guest_info_state.setter
11817 def guest_info_state(self, val):
11818 if self._readonly:
11819 raise ValueError("This VgpuMetadata instance is read-only")
11820 self._ptr[0].guestInfoState = <nvmlVgpuGuestInfoState_t><int>val
11822 @property
11823 def guest_driver_version(self):
11824 """~_numpy.int8: (array of length 80)."""
11825 return cpython.PyUnicode_FromString(self._ptr[0].guestDriverVersion)
11827 @guest_driver_version.setter
11828 def guest_driver_version(self, val):
11829 if self._readonly:
11830 raise ValueError("This VgpuMetadata instance is read-only")
11831 cdef bytes buf = val.encode()
11832 if len(buf) >= 80:
11833 raise ValueError("String too long for field guest_driver_version, max length is 79")
11834 cdef char *ptr = buf
11835 memcpy(<void *>(self._ptr[0].guestDriverVersion), <void *>ptr, 80)
11837 @property
11838 def host_driver_version(self):
11839 """~_numpy.int8: (array of length 80)."""
11840 return cpython.PyUnicode_FromString(self._ptr[0].hostDriverVersion)
11842 @host_driver_version.setter
11843 def host_driver_version(self, val):
11844 if self._readonly:
11845 raise ValueError("This VgpuMetadata instance is read-only")
11846 cdef bytes buf = val.encode()
11847 if len(buf) >= 80:
11848 raise ValueError("String too long for field host_driver_version, max length is 79")
11849 cdef char *ptr = buf
11850 memcpy(<void *>(self._ptr[0].hostDriverVersion), <void *>ptr, 80)
11852 @property
11853 def vgpu_virtualization_caps(self):
11854 """int: """
11855 return self._ptr[0].vgpuVirtualizationCaps
11857 @vgpu_virtualization_caps.setter
11858 def vgpu_virtualization_caps(self, val):
11859 if self._readonly:
11860 raise ValueError("This VgpuMetadata instance is read-only")
11861 self._ptr[0].vgpuVirtualizationCaps = val
11863 @property
11864 def guest_vgpu_version(self):
11865 """int: """
11866 return self._ptr[0].guestVgpuVersion
11868 @guest_vgpu_version.setter
11869 def guest_vgpu_version(self, val):
11870 if self._readonly:
11871 raise ValueError("This VgpuMetadata instance is read-only")
11872 self._ptr[0].guestVgpuVersion = val
11874 @property
11875 def opaque_data_size(self):
11876 """int: """
11877 return self._ptr[0].opaqueDataSize
11879 @opaque_data_size.setter
11880 def opaque_data_size(self, val):
11881 if self._readonly:
11882 raise ValueError("This VgpuMetadata instance is read-only")
11883 self._ptr[0].opaqueDataSize = val
11885 @property
11886 def opaque_data(self):
11887 """~_numpy.int8: (array of length 4)."""
11888 return cpython.PyUnicode_FromString(self._ptr[0].opaqueData)
11890 @opaque_data.setter
11891 def opaque_data(self, val):
11892 if self._readonly:
11893 raise ValueError("This VgpuMetadata instance is read-only")
11894 cdef bytes buf = val.encode()
11895 if len(buf) >= 4:
11896 raise ValueError("String too long for field opaque_data, max length is 3")
11897 cdef char *ptr = buf
11898 memcpy(<void *>(self._ptr[0].opaqueData), <void *>ptr, 4)
11900 @staticmethod
11901 def from_data(data):
11902 """Create an VgpuMetadata instance wrapping the given NumPy array.
11904 Args:
11905 data (_numpy.ndarray): a single-element array of dtype `vgpu_metadata_dtype` holding the data.
11906 """
11907 return __from_data(data, "vgpu_metadata_dtype", vgpu_metadata_dtype, VgpuMetadata)
11909 @staticmethod
11910 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
11911 """Create an VgpuMetadata instance wrapping the given pointer.
11913 Args:
11914 ptr (intptr_t): pointer address as Python :class:`int` to the data.
11915 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
11916 readonly (bool): whether the data is read-only (to the user). default is `False`.
11917 """
11918 if ptr == 0:
11919 raise ValueError("ptr must not be null (0)")
11920 cdef VgpuMetadata obj = VgpuMetadata.__new__(VgpuMetadata)
11921 if owner is None:
11922 obj._ptr = <nvmlVgpuMetadata_t *>malloc(sizeof(nvmlVgpuMetadata_t))
11923 if obj._ptr == NULL:
11924 raise MemoryError("Error allocating VgpuMetadata")
11925 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuMetadata_t))
11926 obj._owner = None
11927 obj._owned = True
11928 else:
11929 obj._ptr = <nvmlVgpuMetadata_t *>ptr
11930 obj._owner = owner
11931 obj._owned = False
11932 obj._readonly = readonly
11933 return obj
11936cdef _get_vgpu_pgpu_compatibility_dtype_offsets():
11937 cdef nvmlVgpuPgpuCompatibility_t pod = nvmlVgpuPgpuCompatibility_t()
11938 return _numpy.dtype({
11939 'names': ['vgpu_vm_compatibility', 'compatibility_limit_code'],
11940 'formats': [_numpy.int32, _numpy.int32],
11941 'offsets': [
11942 (<intptr_t>&(pod.vgpuVmCompatibility)) - (<intptr_t>&pod),
11943 (<intptr_t>&(pod.compatibilityLimitCode)) - (<intptr_t>&pod),
11944 ],
11945 'itemsize': sizeof(nvmlVgpuPgpuCompatibility_t),
11946 })
11948vgpu_pgpu_compatibility_dtype = _get_vgpu_pgpu_compatibility_dtype_offsets()
11950cdef class VgpuPgpuCompatibility:
11951 """Empty-initialize an instance of `nvmlVgpuPgpuCompatibility_t`.
11954 .. seealso:: `nvmlVgpuPgpuCompatibility_t`
11955 """
11956 cdef:
11957 nvmlVgpuPgpuCompatibility_t *_ptr
11958 object _owner
11959 bint _owned
11960 bint _readonly
11962 def __init__(self):
11963 self._ptr = <nvmlVgpuPgpuCompatibility_t *>calloc(1, sizeof(nvmlVgpuPgpuCompatibility_t))
11964 if self._ptr == NULL:
11965 raise MemoryError("Error allocating VgpuPgpuCompatibility")
11966 self._owner = None
11967 self._owned = True
11968 self._readonly = False
11970 def __dealloc__(self):
11971 cdef nvmlVgpuPgpuCompatibility_t *ptr
11972 if self._owned and self._ptr != NULL:
11973 ptr = self._ptr
11974 self._ptr = NULL
11975 free(ptr)
11977 def __repr__(self):
11978 return f"<{__name__}.VgpuPgpuCompatibility object at {hex(id(self))}>"
11980 @property
11981 def ptr(self):
11982 """Get the pointer address to the data as Python :class:`int`."""
11983 return <intptr_t>(self._ptr)
11985 cdef intptr_t _get_ptr(self):
11986 return <intptr_t>(self._ptr)
11988 def __int__(self):
11989 return <intptr_t>(self._ptr)
11991 def __eq__(self, other):
11992 cdef VgpuPgpuCompatibility other_
11993 if not isinstance(other, VgpuPgpuCompatibility):
11994 return False
11995 other_ = other
11996 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuPgpuCompatibility_t)) == 0)
11998 def __setitem__(self, key, val):
11999 if key == 0 and isinstance(val, _numpy.ndarray):
12000 self._ptr = <nvmlVgpuPgpuCompatibility_t *>malloc(sizeof(nvmlVgpuPgpuCompatibility_t))
12001 if self._ptr == NULL:
12002 raise MemoryError("Error allocating VgpuPgpuCompatibility")
12003 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuPgpuCompatibility_t))
12004 self._owner = None
12005 self._owned = True
12006 self._readonly = not val.flags.writeable
12007 else:
12008 setattr(self, key, val)
12010 @property
12011 def vgpu_vm_compatibility(self):
12012 """int: """
12013 return <int>(self._ptr[0].vgpuVmCompatibility)
12015 @vgpu_vm_compatibility.setter
12016 def vgpu_vm_compatibility(self, val):
12017 if self._readonly:
12018 raise ValueError("This VgpuPgpuCompatibility instance is read-only")
12019 self._ptr[0].vgpuVmCompatibility = <nvmlVgpuVmCompatibility_t><int>val
12021 @property
12022 def compatibility_limit_code(self):
12023 """int: """
12024 return <int>(self._ptr[0].compatibilityLimitCode)
12026 @compatibility_limit_code.setter
12027 def compatibility_limit_code(self, val):
12028 if self._readonly:
12029 raise ValueError("This VgpuPgpuCompatibility instance is read-only")
12030 self._ptr[0].compatibilityLimitCode = <nvmlVgpuPgpuCompatibilityLimitCode_t><int>val
12032 @staticmethod
12033 def from_data(data):
12034 """Create an VgpuPgpuCompatibility instance wrapping the given NumPy array.
12036 Args:
12037 data (_numpy.ndarray): a single-element array of dtype `vgpu_pgpu_compatibility_dtype` holding the data.
12038 """
12039 return __from_data(data, "vgpu_pgpu_compatibility_dtype", vgpu_pgpu_compatibility_dtype, VgpuPgpuCompatibility)
12041 @staticmethod
12042 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
12043 """Create an VgpuPgpuCompatibility instance wrapping the given pointer.
12045 Args:
12046 ptr (intptr_t): pointer address as Python :class:`int` to the data.
12047 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
12048 readonly (bool): whether the data is read-only (to the user). default is `False`.
12049 """
12050 if ptr == 0:
12051 raise ValueError("ptr must not be null (0)")
12052 cdef VgpuPgpuCompatibility obj = VgpuPgpuCompatibility.__new__(VgpuPgpuCompatibility)
12053 if owner is None:
12054 obj._ptr = <nvmlVgpuPgpuCompatibility_t *>malloc(sizeof(nvmlVgpuPgpuCompatibility_t))
12055 if obj._ptr == NULL:
12056 raise MemoryError("Error allocating VgpuPgpuCompatibility")
12057 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuPgpuCompatibility_t))
12058 obj._owner = None
12059 obj._owned = True
12060 else:
12061 obj._ptr = <nvmlVgpuPgpuCompatibility_t *>ptr
12062 obj._owner = owner
12063 obj._owned = False
12064 obj._readonly = readonly
12065 return obj
12068cdef _get_gpu_instance_placement_dtype_offsets():
12069 cdef nvmlGpuInstancePlacement_t pod = nvmlGpuInstancePlacement_t()
12070 return _numpy.dtype({
12071 'names': ['start', 'size_'],
12072 'formats': [_numpy.uint32, _numpy.uint32],
12073 'offsets': [
12074 (<intptr_t>&(pod.start)) - (<intptr_t>&pod),
12075 (<intptr_t>&(pod.size)) - (<intptr_t>&pod),
12076 ],
12077 'itemsize': sizeof(nvmlGpuInstancePlacement_t),
12078 })
12080gpu_instance_placement_dtype = _get_gpu_instance_placement_dtype_offsets()
12082cdef class GpuInstancePlacement:
12083 """Empty-initialize an array of `nvmlGpuInstancePlacement_t`.
12085 The resulting object is of length `size` and of dtype `gpu_instance_placement_dtype`.
12086 If default-constructed, the instance represents a single struct.
12088 Args:
12089 size (int): number of structs, default=1.
12092 .. seealso:: `nvmlGpuInstancePlacement_t`
12093 """
12094 cdef:
12095 readonly object _data
12099 def __init__(self, size=1):
12100 arr = _numpy.empty(size, dtype=gpu_instance_placement_dtype)
12101 self._data = arr.view(_numpy.recarray)
12102 assert self._data.itemsize == sizeof(nvmlGpuInstancePlacement_t), \
12103 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlGpuInstancePlacement_t) }"
12105 def __repr__(self):
12106 if self._data.size > 1:
12107 return f"<{__name__}.GpuInstancePlacement_Array_{self._data.size} object at {hex(id(self))}>"
12108 else:
12109 return f"<{__name__}.GpuInstancePlacement object at {hex(id(self))}>"
12111 @property
12112 def ptr(self):
12113 """Get the pointer address to the data as Python :class:`int`."""
12114 return self._data.ctypes.data
12116 cdef intptr_t _get_ptr(self):
12117 return self._data.ctypes.data
12119 def __int__(self):
12120 if self._data.size > 1:
12121 raise TypeError("int() argument must be a bytes-like object of size 1. "
12122 "To get the pointer address of an array, use .ptr")
12123 return self._data.ctypes.data
12125 def __len__(self):
12126 return self._data.size
12128 def __eq__(self, other):
12129 cdef object self_data = self._data
12130 if (not isinstance(other, GpuInstancePlacement)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
12131 return False
12132 return bool((self_data == other._data).all())
12134 @property
12135 def start(self):
12136 """Union[~_numpy.uint32, int]: """
12137 if self._data.size == 1:
12138 return int(self._data.start[0])
12139 return self._data.start
12141 @start.setter
12142 def start(self, val):
12143 self._data.start = val
12145 @property
12146 def size_(self):
12147 """Union[~_numpy.uint32, int]: """
12148 if self._data.size == 1:
12149 return int(self._data.size_[0])
12150 return self._data.size_
12152 @size_.setter
12153 def size_(self, val):
12154 self._data.size_ = val
12156 def __getitem__(self, key):
12157 cdef ssize_t key_
12158 cdef ssize_t size
12159 if isinstance(key, int):
12160 key_ = key
12161 size = self._data.size
12162 if key_ >= size or key_ <= -(size+1):
12163 raise IndexError("index is out of bounds")
12164 if key_ < 0:
12165 key_ += size
12166 return GpuInstancePlacement.from_data(self._data[key_:key_+1])
12167 out = self._data[key]
12168 if isinstance(out, _numpy.recarray) and out.dtype == gpu_instance_placement_dtype:
12169 return GpuInstancePlacement.from_data(out)
12170 return out
12172 def __setitem__(self, key, val):
12173 self._data[key] = val
12175 @staticmethod
12176 def from_data(data):
12177 """Create an GpuInstancePlacement instance wrapping the given NumPy array.
12179 Args:
12180 data (_numpy.ndarray): a 1D array of dtype `gpu_instance_placement_dtype` holding the data.
12181 """
12182 cdef GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement)
12183 if not isinstance(data, _numpy.ndarray):
12184 raise TypeError("data argument must be a NumPy ndarray")
12185 if data.ndim != 1:
12186 raise ValueError("data array must be 1D")
12187 if data.dtype != gpu_instance_placement_dtype:
12188 raise ValueError("data array must be of dtype gpu_instance_placement_dtype")
12189 obj._data = data.view(_numpy.recarray)
12191 return obj
12193 @staticmethod
12194 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
12195 """Create an GpuInstancePlacement instance wrapping the given pointer.
12197 Args:
12198 ptr (intptr_t): pointer address as Python :class:`int` to the data.
12199 size (int): number of structs, default=1.
12200 readonly (bool): whether the data is read-only (to the user). default is `False`.
12201 """
12202 if ptr == 0:
12203 raise ValueError("ptr must not be null (0)")
12204 cdef GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement)
12205 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
12206 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
12207 <char*>ptr, sizeof(nvmlGpuInstancePlacement_t) * size, flag)
12208 data = _numpy.ndarray(size, buffer=buf, dtype=gpu_instance_placement_dtype)
12209 obj._data = data.view(_numpy.recarray)
12211 return obj
12214cdef _get_gpu_instance_profile_info_v3_dtype_offsets():
12215 cdef nvmlGpuInstanceProfileInfo_v3_t pod = nvmlGpuInstanceProfileInfo_v3_t()
12216 return _numpy.dtype({
12217 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'copy_engine_count', 'decoder_count', 'encoder_count', 'jpeg_count', 'ofa_count', 'memory_size_mb', 'name', 'capabilities'],
12218 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64, (_numpy.int8, 96), _numpy.uint32],
12219 'offsets': [
12220 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
12221 (<intptr_t>&(pod.id)) - (<intptr_t>&pod),
12222 (<intptr_t>&(pod.sliceCount)) - (<intptr_t>&pod),
12223 (<intptr_t>&(pod.instanceCount)) - (<intptr_t>&pod),
12224 (<intptr_t>&(pod.multiprocessorCount)) - (<intptr_t>&pod),
12225 (<intptr_t>&(pod.copyEngineCount)) - (<intptr_t>&pod),
12226 (<intptr_t>&(pod.decoderCount)) - (<intptr_t>&pod),
12227 (<intptr_t>&(pod.encoderCount)) - (<intptr_t>&pod),
12228 (<intptr_t>&(pod.jpegCount)) - (<intptr_t>&pod),
12229 (<intptr_t>&(pod.ofaCount)) - (<intptr_t>&pod),
12230 (<intptr_t>&(pod.memorySizeMB)) - (<intptr_t>&pod),
12231 (<intptr_t>&(pod.name)) - (<intptr_t>&pod),
12232 (<intptr_t>&(pod.capabilities)) - (<intptr_t>&pod),
12233 ],
12234 'itemsize': sizeof(nvmlGpuInstanceProfileInfo_v3_t),
12235 })
12237gpu_instance_profile_info_v3_dtype = _get_gpu_instance_profile_info_v3_dtype_offsets()
12239cdef class GpuInstanceProfileInfo_v3:
12240 """Empty-initialize an instance of `nvmlGpuInstanceProfileInfo_v3_t`.
12243 .. seealso:: `nvmlGpuInstanceProfileInfo_v3_t`
12244 """
12245 cdef:
12246 nvmlGpuInstanceProfileInfo_v3_t *_ptr
12247 object _owner
12248 bint _owned
12249 bint _readonly
12251 def __init__(self):
12252 self._ptr = <nvmlGpuInstanceProfileInfo_v3_t *>calloc(1, sizeof(nvmlGpuInstanceProfileInfo_v3_t))
12253 if self._ptr == NULL:
12254 raise MemoryError("Error allocating GpuInstanceProfileInfo_v3")
12255 self._owner = None
12256 self._owned = True
12257 self._readonly = False
12259 def __dealloc__(self):
12260 cdef nvmlGpuInstanceProfileInfo_v3_t *ptr
12261 if self._owned and self._ptr != NULL:
12262 ptr = self._ptr
12263 self._ptr = NULL
12264 free(ptr)
12266 def __repr__(self):
12267 return f"<{__name__}.GpuInstanceProfileInfo_v3 object at {hex(id(self))}>"
12269 @property
12270 def ptr(self):
12271 """Get the pointer address to the data as Python :class:`int`."""
12272 return <intptr_t>(self._ptr)
12274 cdef intptr_t _get_ptr(self):
12275 return <intptr_t>(self._ptr)
12277 def __int__(self):
12278 return <intptr_t>(self._ptr)
12280 def __eq__(self, other):
12281 cdef GpuInstanceProfileInfo_v3 other_
12282 if not isinstance(other, GpuInstanceProfileInfo_v3):
12283 return False
12284 other_ = other
12285 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGpuInstanceProfileInfo_v3_t)) == 0)
12287 def __setitem__(self, key, val):
12288 if key == 0 and isinstance(val, _numpy.ndarray):
12289 self._ptr = <nvmlGpuInstanceProfileInfo_v3_t *>malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t))
12290 if self._ptr == NULL:
12291 raise MemoryError("Error allocating GpuInstanceProfileInfo_v3")
12292 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v3_t))
12293 self._owner = None
12294 self._owned = True
12295 self._readonly = not val.flags.writeable
12296 else:
12297 setattr(self, key, val)
12299 @property
12300 def version(self):
12301 """int: """
12302 return self._ptr[0].version
12304 @version.setter
12305 def version(self, val):
12306 if self._readonly:
12307 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12308 self._ptr[0].version = val
12310 @property
12311 def id(self):
12312 """int: """
12313 return self._ptr[0].id
12315 @id.setter
12316 def id(self, val):
12317 if self._readonly:
12318 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12319 self._ptr[0].id = val
12321 @property
12322 def slice_count(self):
12323 """int: """
12324 return self._ptr[0].sliceCount
12326 @slice_count.setter
12327 def slice_count(self, val):
12328 if self._readonly:
12329 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12330 self._ptr[0].sliceCount = val
12332 @property
12333 def instance_count(self):
12334 """int: """
12335 return self._ptr[0].instanceCount
12337 @instance_count.setter
12338 def instance_count(self, val):
12339 if self._readonly:
12340 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12341 self._ptr[0].instanceCount = val
12343 @property
12344 def multiprocessor_count(self):
12345 """int: """
12346 return self._ptr[0].multiprocessorCount
12348 @multiprocessor_count.setter
12349 def multiprocessor_count(self, val):
12350 if self._readonly:
12351 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12352 self._ptr[0].multiprocessorCount = val
12354 @property
12355 def copy_engine_count(self):
12356 """int: """
12357 return self._ptr[0].copyEngineCount
12359 @copy_engine_count.setter
12360 def copy_engine_count(self, val):
12361 if self._readonly:
12362 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12363 self._ptr[0].copyEngineCount = val
12365 @property
12366 def decoder_count(self):
12367 """int: """
12368 return self._ptr[0].decoderCount
12370 @decoder_count.setter
12371 def decoder_count(self, val):
12372 if self._readonly:
12373 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12374 self._ptr[0].decoderCount = val
12376 @property
12377 def encoder_count(self):
12378 """int: """
12379 return self._ptr[0].encoderCount
12381 @encoder_count.setter
12382 def encoder_count(self, val):
12383 if self._readonly:
12384 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12385 self._ptr[0].encoderCount = val
12387 @property
12388 def jpeg_count(self):
12389 """int: """
12390 return self._ptr[0].jpegCount
12392 @jpeg_count.setter
12393 def jpeg_count(self, val):
12394 if self._readonly:
12395 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12396 self._ptr[0].jpegCount = val
12398 @property
12399 def ofa_count(self):
12400 """int: """
12401 return self._ptr[0].ofaCount
12403 @ofa_count.setter
12404 def ofa_count(self, val):
12405 if self._readonly:
12406 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12407 self._ptr[0].ofaCount = val
12409 @property
12410 def memory_size_mb(self):
12411 """int: """
12412 return self._ptr[0].memorySizeMB
12414 @memory_size_mb.setter
12415 def memory_size_mb(self, val):
12416 if self._readonly:
12417 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12418 self._ptr[0].memorySizeMB = val
12420 @property
12421 def name(self):
12422 """~_numpy.int8: (array of length 96)."""
12423 return cpython.PyUnicode_FromString(self._ptr[0].name)
12425 @name.setter
12426 def name(self, val):
12427 if self._readonly:
12428 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12429 cdef bytes buf = val.encode()
12430 if len(buf) >= 96:
12431 raise ValueError("String too long for field name, max length is 95")
12432 cdef char *ptr = buf
12433 memcpy(<void *>(self._ptr[0].name), <void *>ptr, 96)
12435 @property
12436 def capabilities(self):
12437 """int: """
12438 return self._ptr[0].capabilities
12440 @capabilities.setter
12441 def capabilities(self, val):
12442 if self._readonly:
12443 raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only")
12444 self._ptr[0].capabilities = val
12446 @staticmethod
12447 def from_data(data):
12448 """Create an GpuInstanceProfileInfo_v3 instance wrapping the given NumPy array.
12450 Args:
12451 data (_numpy.ndarray): a single-element array of dtype `gpu_instance_profile_info_v3_dtype` holding the data.
12452 """
12453 return __from_data(data, "gpu_instance_profile_info_v3_dtype", gpu_instance_profile_info_v3_dtype, GpuInstanceProfileInfo_v3)
12455 @staticmethod
12456 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
12457 """Create an GpuInstanceProfileInfo_v3 instance wrapping the given pointer.
12459 Args:
12460 ptr (intptr_t): pointer address as Python :class:`int` to the data.
12461 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
12462 readonly (bool): whether the data is read-only (to the user). default is `False`.
12463 """
12464 if ptr == 0:
12465 raise ValueError("ptr must not be null (0)")
12466 cdef GpuInstanceProfileInfo_v3 obj = GpuInstanceProfileInfo_v3.__new__(GpuInstanceProfileInfo_v3)
12467 if owner is None:
12468 obj._ptr = <nvmlGpuInstanceProfileInfo_v3_t *>malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t))
12469 if obj._ptr == NULL:
12470 raise MemoryError("Error allocating GpuInstanceProfileInfo_v3")
12471 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t))
12472 obj._owner = None
12473 obj._owned = True
12474 else:
12475 obj._ptr = <nvmlGpuInstanceProfileInfo_v3_t *>ptr
12476 obj._owner = owner
12477 obj._owned = False
12478 obj._readonly = readonly
12479 return obj
12482cdef _get_compute_instance_placement_dtype_offsets():
12483 cdef nvmlComputeInstancePlacement_t pod = nvmlComputeInstancePlacement_t()
12484 return _numpy.dtype({
12485 'names': ['start', 'size_'],
12486 'formats': [_numpy.uint32, _numpy.uint32],
12487 'offsets': [
12488 (<intptr_t>&(pod.start)) - (<intptr_t>&pod),
12489 (<intptr_t>&(pod.size)) - (<intptr_t>&pod),
12490 ],
12491 'itemsize': sizeof(nvmlComputeInstancePlacement_t),
12492 })
12494compute_instance_placement_dtype = _get_compute_instance_placement_dtype_offsets()
12496cdef class ComputeInstancePlacement:
12497 """Empty-initialize an array of `nvmlComputeInstancePlacement_t`.
12499 The resulting object is of length `size` and of dtype `compute_instance_placement_dtype`.
12500 If default-constructed, the instance represents a single struct.
12502 Args:
12503 size (int): number of structs, default=1.
12506 .. seealso:: `nvmlComputeInstancePlacement_t`
12507 """
12508 cdef:
12509 readonly object _data
12513 def __init__(self, size=1):
12514 arr = _numpy.empty(size, dtype=compute_instance_placement_dtype)
12515 self._data = arr.view(_numpy.recarray)
12516 assert self._data.itemsize == sizeof(nvmlComputeInstancePlacement_t), \
12517 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlComputeInstancePlacement_t) }"
12519 def __repr__(self):
12520 if self._data.size > 1:
12521 return f"<{__name__}.ComputeInstancePlacement_Array_{self._data.size} object at {hex(id(self))}>"
12522 else:
12523 return f"<{__name__}.ComputeInstancePlacement object at {hex(id(self))}>"
12525 @property
12526 def ptr(self):
12527 """Get the pointer address to the data as Python :class:`int`."""
12528 return self._data.ctypes.data
12530 cdef intptr_t _get_ptr(self):
12531 return self._data.ctypes.data
12533 def __int__(self):
12534 if self._data.size > 1:
12535 raise TypeError("int() argument must be a bytes-like object of size 1. "
12536 "To get the pointer address of an array, use .ptr")
12537 return self._data.ctypes.data
12539 def __len__(self):
12540 return self._data.size
12542 def __eq__(self, other):
12543 cdef object self_data = self._data
12544 if (not isinstance(other, ComputeInstancePlacement)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
12545 return False
12546 return bool((self_data == other._data).all())
12548 @property
12549 def start(self):
12550 """Union[~_numpy.uint32, int]: """
12551 if self._data.size == 1:
12552 return int(self._data.start[0])
12553 return self._data.start
12555 @start.setter
12556 def start(self, val):
12557 self._data.start = val
12559 @property
12560 def size_(self):
12561 """Union[~_numpy.uint32, int]: """
12562 if self._data.size == 1:
12563 return int(self._data.size_[0])
12564 return self._data.size_
12566 @size_.setter
12567 def size_(self, val):
12568 self._data.size_ = val
12570 def __getitem__(self, key):
12571 cdef ssize_t key_
12572 cdef ssize_t size
12573 if isinstance(key, int):
12574 key_ = key
12575 size = self._data.size
12576 if key_ >= size or key_ <= -(size+1):
12577 raise IndexError("index is out of bounds")
12578 if key_ < 0:
12579 key_ += size
12580 return ComputeInstancePlacement.from_data(self._data[key_:key_+1])
12581 out = self._data[key]
12582 if isinstance(out, _numpy.recarray) and out.dtype == compute_instance_placement_dtype:
12583 return ComputeInstancePlacement.from_data(out)
12584 return out
12586 def __setitem__(self, key, val):
12587 self._data[key] = val
12589 @staticmethod
12590 def from_data(data):
12591 """Create an ComputeInstancePlacement instance wrapping the given NumPy array.
12593 Args:
12594 data (_numpy.ndarray): a 1D array of dtype `compute_instance_placement_dtype` holding the data.
12595 """
12596 cdef ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement)
12597 if not isinstance(data, _numpy.ndarray):
12598 raise TypeError("data argument must be a NumPy ndarray")
12599 if data.ndim != 1:
12600 raise ValueError("data array must be 1D")
12601 if data.dtype != compute_instance_placement_dtype:
12602 raise ValueError("data array must be of dtype compute_instance_placement_dtype")
12603 obj._data = data.view(_numpy.recarray)
12605 return obj
12607 @staticmethod
12608 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
12609 """Create an ComputeInstancePlacement instance wrapping the given pointer.
12611 Args:
12612 ptr (intptr_t): pointer address as Python :class:`int` to the data.
12613 size (int): number of structs, default=1.
12614 readonly (bool): whether the data is read-only (to the user). default is `False`.
12615 """
12616 if ptr == 0:
12617 raise ValueError("ptr must not be null (0)")
12618 cdef ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement)
12619 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
12620 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
12621 <char*>ptr, sizeof(nvmlComputeInstancePlacement_t) * size, flag)
12622 data = _numpy.ndarray(size, buffer=buf, dtype=compute_instance_placement_dtype)
12623 obj._data = data.view(_numpy.recarray)
12625 return obj
12628cdef _get_compute_instance_profile_info_v2_dtype_offsets():
12629 cdef nvmlComputeInstanceProfileInfo_v2_t pod = nvmlComputeInstanceProfileInfo_v2_t()
12630 return _numpy.dtype({
12631 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'name'],
12632 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 96)],
12633 'offsets': [
12634 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
12635 (<intptr_t>&(pod.id)) - (<intptr_t>&pod),
12636 (<intptr_t>&(pod.sliceCount)) - (<intptr_t>&pod),
12637 (<intptr_t>&(pod.instanceCount)) - (<intptr_t>&pod),
12638 (<intptr_t>&(pod.multiprocessorCount)) - (<intptr_t>&pod),
12639 (<intptr_t>&(pod.sharedCopyEngineCount)) - (<intptr_t>&pod),
12640 (<intptr_t>&(pod.sharedDecoderCount)) - (<intptr_t>&pod),
12641 (<intptr_t>&(pod.sharedEncoderCount)) - (<intptr_t>&pod),
12642 (<intptr_t>&(pod.sharedJpegCount)) - (<intptr_t>&pod),
12643 (<intptr_t>&(pod.sharedOfaCount)) - (<intptr_t>&pod),
12644 (<intptr_t>&(pod.name)) - (<intptr_t>&pod),
12645 ],
12646 'itemsize': sizeof(nvmlComputeInstanceProfileInfo_v2_t),
12647 })
12649compute_instance_profile_info_v2_dtype = _get_compute_instance_profile_info_v2_dtype_offsets()
12651cdef class ComputeInstanceProfileInfo_v2:
12652 """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v2_t`.
12655 .. seealso:: `nvmlComputeInstanceProfileInfo_v2_t`
12656 """
12657 cdef:
12658 nvmlComputeInstanceProfileInfo_v2_t *_ptr
12659 object _owner
12660 bint _owned
12661 bint _readonly
12663 def __init__(self):
12664 self._ptr = <nvmlComputeInstanceProfileInfo_v2_t *>calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v2_t))
12665 if self._ptr == NULL:
12666 raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2")
12667 self._owner = None
12668 self._owned = True
12669 self._readonly = False
12671 def __dealloc__(self):
12672 cdef nvmlComputeInstanceProfileInfo_v2_t *ptr
12673 if self._owned and self._ptr != NULL:
12674 ptr = self._ptr
12675 self._ptr = NULL
12676 free(ptr)
12678 def __repr__(self):
12679 return f"<{__name__}.ComputeInstanceProfileInfo_v2 object at {hex(id(self))}>"
12681 @property
12682 def ptr(self):
12683 """Get the pointer address to the data as Python :class:`int`."""
12684 return <intptr_t>(self._ptr)
12686 cdef intptr_t _get_ptr(self):
12687 return <intptr_t>(self._ptr)
12689 def __int__(self):
12690 return <intptr_t>(self._ptr)
12692 def __eq__(self, other):
12693 cdef ComputeInstanceProfileInfo_v2 other_
12694 if not isinstance(other, ComputeInstanceProfileInfo_v2):
12695 return False
12696 other_ = other
12697 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v2_t)) == 0)
12699 def __setitem__(self, key, val):
12700 if key == 0 and isinstance(val, _numpy.ndarray):
12701 self._ptr = <nvmlComputeInstanceProfileInfo_v2_t *>malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t))
12702 if self._ptr == NULL:
12703 raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2")
12704 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v2_t))
12705 self._owner = None
12706 self._owned = True
12707 self._readonly = not val.flags.writeable
12708 else:
12709 setattr(self, key, val)
12711 @property
12712 def version(self):
12713 """int: """
12714 return self._ptr[0].version
12716 @version.setter
12717 def version(self, val):
12718 if self._readonly:
12719 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12720 self._ptr[0].version = val
12722 @property
12723 def id(self):
12724 """int: """
12725 return self._ptr[0].id
12727 @id.setter
12728 def id(self, val):
12729 if self._readonly:
12730 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12731 self._ptr[0].id = val
12733 @property
12734 def slice_count(self):
12735 """int: """
12736 return self._ptr[0].sliceCount
12738 @slice_count.setter
12739 def slice_count(self, val):
12740 if self._readonly:
12741 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12742 self._ptr[0].sliceCount = val
12744 @property
12745 def instance_count(self):
12746 """int: """
12747 return self._ptr[0].instanceCount
12749 @instance_count.setter
12750 def instance_count(self, val):
12751 if self._readonly:
12752 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12753 self._ptr[0].instanceCount = val
12755 @property
12756 def multiprocessor_count(self):
12757 """int: """
12758 return self._ptr[0].multiprocessorCount
12760 @multiprocessor_count.setter
12761 def multiprocessor_count(self, val):
12762 if self._readonly:
12763 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12764 self._ptr[0].multiprocessorCount = val
12766 @property
12767 def shared_copy_engine_count(self):
12768 """int: """
12769 return self._ptr[0].sharedCopyEngineCount
12771 @shared_copy_engine_count.setter
12772 def shared_copy_engine_count(self, val):
12773 if self._readonly:
12774 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12775 self._ptr[0].sharedCopyEngineCount = val
12777 @property
12778 def shared_decoder_count(self):
12779 """int: """
12780 return self._ptr[0].sharedDecoderCount
12782 @shared_decoder_count.setter
12783 def shared_decoder_count(self, val):
12784 if self._readonly:
12785 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12786 self._ptr[0].sharedDecoderCount = val
12788 @property
12789 def shared_encoder_count(self):
12790 """int: """
12791 return self._ptr[0].sharedEncoderCount
12793 @shared_encoder_count.setter
12794 def shared_encoder_count(self, val):
12795 if self._readonly:
12796 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12797 self._ptr[0].sharedEncoderCount = val
12799 @property
12800 def shared_jpeg_count(self):
12801 """int: """
12802 return self._ptr[0].sharedJpegCount
12804 @shared_jpeg_count.setter
12805 def shared_jpeg_count(self, val):
12806 if self._readonly:
12807 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12808 self._ptr[0].sharedJpegCount = val
12810 @property
12811 def shared_ofa_count(self):
12812 """int: """
12813 return self._ptr[0].sharedOfaCount
12815 @shared_ofa_count.setter
12816 def shared_ofa_count(self, val):
12817 if self._readonly:
12818 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12819 self._ptr[0].sharedOfaCount = val
12821 @property
12822 def name(self):
12823 """~_numpy.int8: (array of length 96)."""
12824 return cpython.PyUnicode_FromString(self._ptr[0].name)
12826 @name.setter
12827 def name(self, val):
12828 if self._readonly:
12829 raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only")
12830 cdef bytes buf = val.encode()
12831 if len(buf) >= 96:
12832 raise ValueError("String too long for field name, max length is 95")
12833 cdef char *ptr = buf
12834 memcpy(<void *>(self._ptr[0].name), <void *>ptr, 96)
12836 @staticmethod
12837 def from_data(data):
12838 """Create an ComputeInstanceProfileInfo_v2 instance wrapping the given NumPy array.
12840 Args:
12841 data (_numpy.ndarray): a single-element array of dtype `compute_instance_profile_info_v2_dtype` holding the data.
12842 """
12843 return __from_data(data, "compute_instance_profile_info_v2_dtype", compute_instance_profile_info_v2_dtype, ComputeInstanceProfileInfo_v2)
12845 @staticmethod
12846 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
12847 """Create an ComputeInstanceProfileInfo_v2 instance wrapping the given pointer.
12849 Args:
12850 ptr (intptr_t): pointer address as Python :class:`int` to the data.
12851 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
12852 readonly (bool): whether the data is read-only (to the user). default is `False`.
12853 """
12854 if ptr == 0:
12855 raise ValueError("ptr must not be null (0)")
12856 cdef ComputeInstanceProfileInfo_v2 obj = ComputeInstanceProfileInfo_v2.__new__(ComputeInstanceProfileInfo_v2)
12857 if owner is None:
12858 obj._ptr = <nvmlComputeInstanceProfileInfo_v2_t *>malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t))
12859 if obj._ptr == NULL:
12860 raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2")
12861 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t))
12862 obj._owner = None
12863 obj._owned = True
12864 else:
12865 obj._ptr = <nvmlComputeInstanceProfileInfo_v2_t *>ptr
12866 obj._owner = owner
12867 obj._owned = False
12868 obj._readonly = readonly
12869 return obj
12872cdef _get_compute_instance_profile_info_v3_dtype_offsets():
12873 cdef nvmlComputeInstanceProfileInfo_v3_t pod = nvmlComputeInstanceProfileInfo_v3_t()
12874 return _numpy.dtype({
12875 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'name', 'capabilities'],
12876 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 96), _numpy.uint32],
12877 'offsets': [
12878 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
12879 (<intptr_t>&(pod.id)) - (<intptr_t>&pod),
12880 (<intptr_t>&(pod.sliceCount)) - (<intptr_t>&pod),
12881 (<intptr_t>&(pod.instanceCount)) - (<intptr_t>&pod),
12882 (<intptr_t>&(pod.multiprocessorCount)) - (<intptr_t>&pod),
12883 (<intptr_t>&(pod.sharedCopyEngineCount)) - (<intptr_t>&pod),
12884 (<intptr_t>&(pod.sharedDecoderCount)) - (<intptr_t>&pod),
12885 (<intptr_t>&(pod.sharedEncoderCount)) - (<intptr_t>&pod),
12886 (<intptr_t>&(pod.sharedJpegCount)) - (<intptr_t>&pod),
12887 (<intptr_t>&(pod.sharedOfaCount)) - (<intptr_t>&pod),
12888 (<intptr_t>&(pod.name)) - (<intptr_t>&pod),
12889 (<intptr_t>&(pod.capabilities)) - (<intptr_t>&pod),
12890 ],
12891 'itemsize': sizeof(nvmlComputeInstanceProfileInfo_v3_t),
12892 })
12894compute_instance_profile_info_v3_dtype = _get_compute_instance_profile_info_v3_dtype_offsets()
12896cdef class ComputeInstanceProfileInfo_v3:
12897 """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v3_t`.
12900 .. seealso:: `nvmlComputeInstanceProfileInfo_v3_t`
12901 """
12902 cdef:
12903 nvmlComputeInstanceProfileInfo_v3_t *_ptr
12904 object _owner
12905 bint _owned
12906 bint _readonly
12908 def __init__(self):
12909 self._ptr = <nvmlComputeInstanceProfileInfo_v3_t *>calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v3_t))
12910 if self._ptr == NULL:
12911 raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3")
12912 self._owner = None
12913 self._owned = True
12914 self._readonly = False
12916 def __dealloc__(self):
12917 cdef nvmlComputeInstanceProfileInfo_v3_t *ptr
12918 if self._owned and self._ptr != NULL:
12919 ptr = self._ptr
12920 self._ptr = NULL
12921 free(ptr)
12923 def __repr__(self):
12924 return f"<{__name__}.ComputeInstanceProfileInfo_v3 object at {hex(id(self))}>"
12926 @property
12927 def ptr(self):
12928 """Get the pointer address to the data as Python :class:`int`."""
12929 return <intptr_t>(self._ptr)
12931 cdef intptr_t _get_ptr(self):
12932 return <intptr_t>(self._ptr)
12934 def __int__(self):
12935 return <intptr_t>(self._ptr)
12937 def __eq__(self, other):
12938 cdef ComputeInstanceProfileInfo_v3 other_
12939 if not isinstance(other, ComputeInstanceProfileInfo_v3):
12940 return False
12941 other_ = other
12942 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v3_t)) == 0)
12944 def __setitem__(self, key, val):
12945 if key == 0 and isinstance(val, _numpy.ndarray):
12946 self._ptr = <nvmlComputeInstanceProfileInfo_v3_t *>malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t))
12947 if self._ptr == NULL:
12948 raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3")
12949 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v3_t))
12950 self._owner = None
12951 self._owned = True
12952 self._readonly = not val.flags.writeable
12953 else:
12954 setattr(self, key, val)
12956 @property
12957 def version(self):
12958 """int: """
12959 return self._ptr[0].version
12961 @version.setter
12962 def version(self, val):
12963 if self._readonly:
12964 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
12965 self._ptr[0].version = val
12967 @property
12968 def id(self):
12969 """int: """
12970 return self._ptr[0].id
12972 @id.setter
12973 def id(self, val):
12974 if self._readonly:
12975 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
12976 self._ptr[0].id = val
12978 @property
12979 def slice_count(self):
12980 """int: """
12981 return self._ptr[0].sliceCount
12983 @slice_count.setter
12984 def slice_count(self, val):
12985 if self._readonly:
12986 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
12987 self._ptr[0].sliceCount = val
12989 @property
12990 def instance_count(self):
12991 """int: """
12992 return self._ptr[0].instanceCount
12994 @instance_count.setter
12995 def instance_count(self, val):
12996 if self._readonly:
12997 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
12998 self._ptr[0].instanceCount = val
13000 @property
13001 def multiprocessor_count(self):
13002 """int: """
13003 return self._ptr[0].multiprocessorCount
13005 @multiprocessor_count.setter
13006 def multiprocessor_count(self, val):
13007 if self._readonly:
13008 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13009 self._ptr[0].multiprocessorCount = val
13011 @property
13012 def shared_copy_engine_count(self):
13013 """int: """
13014 return self._ptr[0].sharedCopyEngineCount
13016 @shared_copy_engine_count.setter
13017 def shared_copy_engine_count(self, val):
13018 if self._readonly:
13019 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13020 self._ptr[0].sharedCopyEngineCount = val
13022 @property
13023 def shared_decoder_count(self):
13024 """int: """
13025 return self._ptr[0].sharedDecoderCount
13027 @shared_decoder_count.setter
13028 def shared_decoder_count(self, val):
13029 if self._readonly:
13030 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13031 self._ptr[0].sharedDecoderCount = val
13033 @property
13034 def shared_encoder_count(self):
13035 """int: """
13036 return self._ptr[0].sharedEncoderCount
13038 @shared_encoder_count.setter
13039 def shared_encoder_count(self, val):
13040 if self._readonly:
13041 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13042 self._ptr[0].sharedEncoderCount = val
13044 @property
13045 def shared_jpeg_count(self):
13046 """int: """
13047 return self._ptr[0].sharedJpegCount
13049 @shared_jpeg_count.setter
13050 def shared_jpeg_count(self, val):
13051 if self._readonly:
13052 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13053 self._ptr[0].sharedJpegCount = val
13055 @property
13056 def shared_ofa_count(self):
13057 """int: """
13058 return self._ptr[0].sharedOfaCount
13060 @shared_ofa_count.setter
13061 def shared_ofa_count(self, val):
13062 if self._readonly:
13063 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13064 self._ptr[0].sharedOfaCount = val
13066 @property
13067 def name(self):
13068 """~_numpy.int8: (array of length 96)."""
13069 return cpython.PyUnicode_FromString(self._ptr[0].name)
13071 @name.setter
13072 def name(self, val):
13073 if self._readonly:
13074 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13075 cdef bytes buf = val.encode()
13076 if len(buf) >= 96:
13077 raise ValueError("String too long for field name, max length is 95")
13078 cdef char *ptr = buf
13079 memcpy(<void *>(self._ptr[0].name), <void *>ptr, 96)
13081 @property
13082 def capabilities(self):
13083 """int: """
13084 return self._ptr[0].capabilities
13086 @capabilities.setter
13087 def capabilities(self, val):
13088 if self._readonly:
13089 raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only")
13090 self._ptr[0].capabilities = val
13092 @staticmethod
13093 def from_data(data):
13094 """Create an ComputeInstanceProfileInfo_v3 instance wrapping the given NumPy array.
13096 Args:
13097 data (_numpy.ndarray): a single-element array of dtype `compute_instance_profile_info_v3_dtype` holding the data.
13098 """
13099 return __from_data(data, "compute_instance_profile_info_v3_dtype", compute_instance_profile_info_v3_dtype, ComputeInstanceProfileInfo_v3)
13101 @staticmethod
13102 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
13103 """Create an ComputeInstanceProfileInfo_v3 instance wrapping the given pointer.
13105 Args:
13106 ptr (intptr_t): pointer address as Python :class:`int` to the data.
13107 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
13108 readonly (bool): whether the data is read-only (to the user). default is `False`.
13109 """
13110 if ptr == 0:
13111 raise ValueError("ptr must not be null (0)")
13112 cdef ComputeInstanceProfileInfo_v3 obj = ComputeInstanceProfileInfo_v3.__new__(ComputeInstanceProfileInfo_v3)
13113 if owner is None:
13114 obj._ptr = <nvmlComputeInstanceProfileInfo_v3_t *>malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t))
13115 if obj._ptr == NULL:
13116 raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3")
13117 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t))
13118 obj._owner = None
13119 obj._owned = True
13120 else:
13121 obj._ptr = <nvmlComputeInstanceProfileInfo_v3_t *>ptr
13122 obj._owner = owner
13123 obj._owned = False
13124 obj._readonly = readonly
13125 return obj
13128cdef _get_device_addressing_mode_v1_dtype_offsets():
13129 cdef nvmlDeviceAddressingMode_v1_t pod = nvmlDeviceAddressingMode_v1_t()
13130 return _numpy.dtype({
13131 'names': ['version', 'value'],
13132 'formats': [_numpy.uint32, _numpy.uint32],
13133 'offsets': [
13134 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
13135 (<intptr_t>&(pod.value)) - (<intptr_t>&pod),
13136 ],
13137 'itemsize': sizeof(nvmlDeviceAddressingMode_v1_t),
13138 })
13140device_addressing_mode_v1_dtype = _get_device_addressing_mode_v1_dtype_offsets()
13142cdef class DeviceAddressingMode_v1:
13143 """Empty-initialize an instance of `nvmlDeviceAddressingMode_v1_t`.
13146 .. seealso:: `nvmlDeviceAddressingMode_v1_t`
13147 """
13148 cdef:
13149 nvmlDeviceAddressingMode_v1_t *_ptr
13150 object _owner
13151 bint _owned
13152 bint _readonly
13154 def __init__(self):
13155 self._ptr = <nvmlDeviceAddressingMode_v1_t *>calloc(1, sizeof(nvmlDeviceAddressingMode_v1_t)) 1i
13156 if self._ptr == NULL: 1i
13157 raise MemoryError("Error allocating DeviceAddressingMode_v1")
13158 self._owner = None 1i
13159 self._owned = True 1i
13160 self._readonly = False 1i
13162 def __dealloc__(self):
13163 cdef nvmlDeviceAddressingMode_v1_t *ptr
13164 if self._owned and self._ptr != NULL: 1i
13165 ptr = self._ptr 1i
13166 self._ptr = NULL 1i
13167 free(ptr) 1i
13169 def __repr__(self):
13170 return f"<{__name__}.DeviceAddressingMode_v1 object at {hex(id(self))}>"
13172 @property
13173 def ptr(self):
13174 """Get the pointer address to the data as Python :class:`int`."""
13175 return <intptr_t>(self._ptr)
13177 cdef intptr_t _get_ptr(self):
13178 return <intptr_t>(self._ptr) 1i
13180 def __int__(self):
13181 return <intptr_t>(self._ptr)
13183 def __eq__(self, other):
13184 cdef DeviceAddressingMode_v1 other_
13185 if not isinstance(other, DeviceAddressingMode_v1):
13186 return False
13187 other_ = other
13188 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlDeviceAddressingMode_v1_t)) == 0)
13190 def __setitem__(self, key, val):
13191 if key == 0 and isinstance(val, _numpy.ndarray):
13192 self._ptr = <nvmlDeviceAddressingMode_v1_t *>malloc(sizeof(nvmlDeviceAddressingMode_v1_t))
13193 if self._ptr == NULL:
13194 raise MemoryError("Error allocating DeviceAddressingMode_v1")
13195 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlDeviceAddressingMode_v1_t))
13196 self._owner = None
13197 self._owned = True
13198 self._readonly = not val.flags.writeable
13199 else:
13200 setattr(self, key, val)
13202 @property
13203 def version(self):
13204 """int: API version."""
13205 return self._ptr[0].version
13207 @version.setter
13208 def version(self, val):
13209 if self._readonly:
13210 raise ValueError("This DeviceAddressingMode_v1 instance is read-only")
13211 self._ptr[0].version = val
13213 @property
13214 def value(self):
13215 """int: One of `nvmlDeviceAddressingModeType_t`."""
13216 return self._ptr[0].value 1i
13218 @value.setter
13219 def value(self, val):
13220 if self._readonly:
13221 raise ValueError("This DeviceAddressingMode_v1 instance is read-only")
13222 self._ptr[0].value = val
13224 @staticmethod
13225 def from_data(data):
13226 """Create an DeviceAddressingMode_v1 instance wrapping the given NumPy array.
13228 Args:
13229 data (_numpy.ndarray): a single-element array of dtype `device_addressing_mode_v1_dtype` holding the data.
13230 """
13231 return __from_data(data, "device_addressing_mode_v1_dtype", device_addressing_mode_v1_dtype, DeviceAddressingMode_v1)
13233 @staticmethod
13234 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
13235 """Create an DeviceAddressingMode_v1 instance wrapping the given pointer.
13237 Args:
13238 ptr (intptr_t): pointer address as Python :class:`int` to the data.
13239 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
13240 readonly (bool): whether the data is read-only (to the user). default is `False`.
13241 """
13242 if ptr == 0:
13243 raise ValueError("ptr must not be null (0)")
13244 cdef DeviceAddressingMode_v1 obj = DeviceAddressingMode_v1.__new__(DeviceAddressingMode_v1)
13245 if owner is None:
13246 obj._ptr = <nvmlDeviceAddressingMode_v1_t *>malloc(sizeof(nvmlDeviceAddressingMode_v1_t))
13247 if obj._ptr == NULL:
13248 raise MemoryError("Error allocating DeviceAddressingMode_v1")
13249 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlDeviceAddressingMode_v1_t))
13250 obj._owner = None
13251 obj._owned = True
13252 else:
13253 obj._ptr = <nvmlDeviceAddressingMode_v1_t *>ptr
13254 obj._owner = owner
13255 obj._owned = False
13256 obj._readonly = readonly
13257 return obj
13260cdef _get_repair_status_v1_dtype_offsets():
13261 cdef nvmlRepairStatus_v1_t pod = nvmlRepairStatus_v1_t()
13262 return _numpy.dtype({
13263 'names': ['version', 'b_channel_repair_pending', 'b_tpc_repair_pending'],
13264 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32],
13265 'offsets': [
13266 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
13267 (<intptr_t>&(pod.bChannelRepairPending)) - (<intptr_t>&pod),
13268 (<intptr_t>&(pod.bTpcRepairPending)) - (<intptr_t>&pod),
13269 ],
13270 'itemsize': sizeof(nvmlRepairStatus_v1_t),
13271 })
13273repair_status_v1_dtype = _get_repair_status_v1_dtype_offsets()
13275cdef class RepairStatus_v1:
13276 """Empty-initialize an instance of `nvmlRepairStatus_v1_t`.
13279 .. seealso:: `nvmlRepairStatus_v1_t`
13280 """
13281 cdef:
13282 nvmlRepairStatus_v1_t *_ptr
13283 object _owner
13284 bint _owned
13285 bint _readonly
13287 def __init__(self):
13288 self._ptr = <nvmlRepairStatus_v1_t *>calloc(1, sizeof(nvmlRepairStatus_v1_t)) 1t
13289 if self._ptr == NULL: 1t
13290 raise MemoryError("Error allocating RepairStatus_v1")
13291 self._owner = None 1t
13292 self._owned = True 1t
13293 self._readonly = False 1t
13295 def __dealloc__(self):
13296 cdef nvmlRepairStatus_v1_t *ptr
13297 if self._owned and self._ptr != NULL: 1t
13298 ptr = self._ptr 1t
13299 self._ptr = NULL 1t
13300 free(ptr) 1t
13302 def __repr__(self):
13303 return f"<{__name__}.RepairStatus_v1 object at {hex(id(self))}>"
13305 @property
13306 def ptr(self):
13307 """Get the pointer address to the data as Python :class:`int`."""
13308 return <intptr_t>(self._ptr)
13310 cdef intptr_t _get_ptr(self):
13311 return <intptr_t>(self._ptr) 1t
13313 def __int__(self):
13314 return <intptr_t>(self._ptr)
13316 def __eq__(self, other):
13317 cdef RepairStatus_v1 other_
13318 if not isinstance(other, RepairStatus_v1):
13319 return False
13320 other_ = other
13321 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlRepairStatus_v1_t)) == 0)
13323 def __setitem__(self, key, val):
13324 if key == 0 and isinstance(val, _numpy.ndarray):
13325 self._ptr = <nvmlRepairStatus_v1_t *>malloc(sizeof(nvmlRepairStatus_v1_t))
13326 if self._ptr == NULL:
13327 raise MemoryError("Error allocating RepairStatus_v1")
13328 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlRepairStatus_v1_t))
13329 self._owner = None
13330 self._owned = True
13331 self._readonly = not val.flags.writeable
13332 else:
13333 setattr(self, key, val)
13335 @property
13336 def version(self):
13337 """int: API version number."""
13338 return self._ptr[0].version
13340 @version.setter
13341 def version(self, val):
13342 if self._readonly:
13343 raise ValueError("This RepairStatus_v1 instance is read-only")
13344 self._ptr[0].version = val
13346 @property
13347 def b_channel_repair_pending(self):
13348 """int: Reference to `unsigned` int."""
13349 return self._ptr[0].bChannelRepairPending 1t
13351 @b_channel_repair_pending.setter
13352 def b_channel_repair_pending(self, val):
13353 if self._readonly:
13354 raise ValueError("This RepairStatus_v1 instance is read-only")
13355 self._ptr[0].bChannelRepairPending = val
13357 @property
13358 def b_tpc_repair_pending(self):
13359 """int: Reference to `unsigned` int."""
13360 return self._ptr[0].bTpcRepairPending 1t
13362 @b_tpc_repair_pending.setter
13363 def b_tpc_repair_pending(self, val):
13364 if self._readonly:
13365 raise ValueError("This RepairStatus_v1 instance is read-only")
13366 self._ptr[0].bTpcRepairPending = val
13368 @staticmethod
13369 def from_data(data):
13370 """Create an RepairStatus_v1 instance wrapping the given NumPy array.
13372 Args:
13373 data (_numpy.ndarray): a single-element array of dtype `repair_status_v1_dtype` holding the data.
13374 """
13375 return __from_data(data, "repair_status_v1_dtype", repair_status_v1_dtype, RepairStatus_v1)
13377 @staticmethod
13378 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
13379 """Create an RepairStatus_v1 instance wrapping the given pointer.
13381 Args:
13382 ptr (intptr_t): pointer address as Python :class:`int` to the data.
13383 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
13384 readonly (bool): whether the data is read-only (to the user). default is `False`.
13385 """
13386 if ptr == 0:
13387 raise ValueError("ptr must not be null (0)")
13388 cdef RepairStatus_v1 obj = RepairStatus_v1.__new__(RepairStatus_v1)
13389 if owner is None:
13390 obj._ptr = <nvmlRepairStatus_v1_t *>malloc(sizeof(nvmlRepairStatus_v1_t))
13391 if obj._ptr == NULL:
13392 raise MemoryError("Error allocating RepairStatus_v1")
13393 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlRepairStatus_v1_t))
13394 obj._owner = None
13395 obj._owned = True
13396 else:
13397 obj._ptr = <nvmlRepairStatus_v1_t *>ptr
13398 obj._owner = owner
13399 obj._owned = False
13400 obj._readonly = readonly
13401 return obj
13404cdef _get_device_power_mizer_modes_v1_dtype_offsets():
13405 cdef nvmlDevicePowerMizerModes_v1_t pod = nvmlDevicePowerMizerModes_v1_t()
13406 return _numpy.dtype({
13407 'names': ['current_mode', 'mode', 'supported_power_mizer_modes'],
13408 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32],
13409 'offsets': [
13410 (<intptr_t>&(pod.currentMode)) - (<intptr_t>&pod),
13411 (<intptr_t>&(pod.mode)) - (<intptr_t>&pod),
13412 (<intptr_t>&(pod.supportedPowerMizerModes)) - (<intptr_t>&pod),
13413 ],
13414 'itemsize': sizeof(nvmlDevicePowerMizerModes_v1_t),
13415 })
13417device_power_mizer_modes_v1_dtype = _get_device_power_mizer_modes_v1_dtype_offsets()
13419cdef class DevicePowerMizerModes_v1:
13420 """Empty-initialize an instance of `nvmlDevicePowerMizerModes_v1_t`.
13423 .. seealso:: `nvmlDevicePowerMizerModes_v1_t`
13424 """
13425 cdef:
13426 nvmlDevicePowerMizerModes_v1_t *_ptr
13427 object _owner
13428 bint _owned
13429 bint _readonly
13431 def __init__(self):
13432 self._ptr = <nvmlDevicePowerMizerModes_v1_t *>calloc(1, sizeof(nvmlDevicePowerMizerModes_v1_t))
13433 if self._ptr == NULL:
13434 raise MemoryError("Error allocating DevicePowerMizerModes_v1")
13435 self._owner = None
13436 self._owned = True
13437 self._readonly = False
13439 def __dealloc__(self):
13440 cdef nvmlDevicePowerMizerModes_v1_t *ptr
13441 if self._owned and self._ptr != NULL:
13442 ptr = self._ptr
13443 self._ptr = NULL
13444 free(ptr)
13446 def __repr__(self):
13447 return f"<{__name__}.DevicePowerMizerModes_v1 object at {hex(id(self))}>"
13449 @property
13450 def ptr(self):
13451 """Get the pointer address to the data as Python :class:`int`."""
13452 return <intptr_t>(self._ptr)
13454 cdef intptr_t _get_ptr(self):
13455 return <intptr_t>(self._ptr)
13457 def __int__(self):
13458 return <intptr_t>(self._ptr)
13460 def __eq__(self, other):
13461 cdef DevicePowerMizerModes_v1 other_
13462 if not isinstance(other, DevicePowerMizerModes_v1):
13463 return False
13464 other_ = other
13465 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlDevicePowerMizerModes_v1_t)) == 0)
13467 def __setitem__(self, key, val):
13468 if key == 0 and isinstance(val, _numpy.ndarray):
13469 self._ptr = <nvmlDevicePowerMizerModes_v1_t *>malloc(sizeof(nvmlDevicePowerMizerModes_v1_t))
13470 if self._ptr == NULL:
13471 raise MemoryError("Error allocating DevicePowerMizerModes_v1")
13472 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlDevicePowerMizerModes_v1_t))
13473 self._owner = None
13474 self._owned = True
13475 self._readonly = not val.flags.writeable
13476 else:
13477 setattr(self, key, val)
13479 @property
13480 def current_mode(self):
13481 """int: OUT: the current powermizer mode."""
13482 return self._ptr[0].currentMode
13484 @current_mode.setter
13485 def current_mode(self, val):
13486 if self._readonly:
13487 raise ValueError("This DevicePowerMizerModes_v1 instance is read-only")
13488 self._ptr[0].currentMode = val
13490 @property
13491 def mode(self):
13492 """int: IN: the powermizer mode to set."""
13493 return self._ptr[0].mode
13495 @mode.setter
13496 def mode(self, val):
13497 if self._readonly:
13498 raise ValueError("This DevicePowerMizerModes_v1 instance is read-only")
13499 self._ptr[0].mode = val
13501 @property
13502 def supported_power_mizer_modes(self):
13503 """int: OUT: Bitmask of supported powermizer modes. The bitmask of supported power mizer modes on this device. The supported modes can be combined using the bitwise OR operator '|'. For example, if a device supports all PowerMizer modes, the bitmask would be: supportedPowerMizerModes = ((1 << NVML_POWER_MIZER_MODE_ADAPTIVE) | (1 << NVML_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE) | (1 << NVML_POWER_MIZER_MODE_AUTO) | (1 << NVML_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE)); This bitmask can be used to check which power mizer modes are available on the device by performing a bitwise AND operation with the specific mode you want to check."""
13504 return self._ptr[0].supportedPowerMizerModes
13506 @supported_power_mizer_modes.setter
13507 def supported_power_mizer_modes(self, val):
13508 if self._readonly:
13509 raise ValueError("This DevicePowerMizerModes_v1 instance is read-only")
13510 self._ptr[0].supportedPowerMizerModes = val
13512 @staticmethod
13513 def from_data(data):
13514 """Create an DevicePowerMizerModes_v1 instance wrapping the given NumPy array.
13516 Args:
13517 data (_numpy.ndarray): a single-element array of dtype `device_power_mizer_modes_v1_dtype` holding the data.
13518 """
13519 return __from_data(data, "device_power_mizer_modes_v1_dtype", device_power_mizer_modes_v1_dtype, DevicePowerMizerModes_v1)
13521 @staticmethod
13522 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
13523 """Create an DevicePowerMizerModes_v1 instance wrapping the given pointer.
13525 Args:
13526 ptr (intptr_t): pointer address as Python :class:`int` to the data.
13527 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
13528 readonly (bool): whether the data is read-only (to the user). default is `False`.
13529 """
13530 if ptr == 0:
13531 raise ValueError("ptr must not be null (0)")
13532 cdef DevicePowerMizerModes_v1 obj = DevicePowerMizerModes_v1.__new__(DevicePowerMizerModes_v1)
13533 if owner is None:
13534 obj._ptr = <nvmlDevicePowerMizerModes_v1_t *>malloc(sizeof(nvmlDevicePowerMizerModes_v1_t))
13535 if obj._ptr == NULL:
13536 raise MemoryError("Error allocating DevicePowerMizerModes_v1")
13537 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlDevicePowerMizerModes_v1_t))
13538 obj._owner = None
13539 obj._owned = True
13540 else:
13541 obj._ptr = <nvmlDevicePowerMizerModes_v1_t *>ptr
13542 obj._owner = owner
13543 obj._owned = False
13544 obj._readonly = readonly
13545 return obj
13548cdef _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets():
13549 cdef nvmlEccSramUniqueUncorrectedErrorEntry_v1_t pod = nvmlEccSramUniqueUncorrectedErrorEntry_v1_t()
13550 return _numpy.dtype({
13551 'names': ['unit', 'location', 'sublocation', 'extlocation', 'address', 'is_parity', 'count'],
13552 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32],
13553 'offsets': [
13554 (<intptr_t>&(pod.unit)) - (<intptr_t>&pod),
13555 (<intptr_t>&(pod.location)) - (<intptr_t>&pod),
13556 (<intptr_t>&(pod.sublocation)) - (<intptr_t>&pod),
13557 (<intptr_t>&(pod.extlocation)) - (<intptr_t>&pod),
13558 (<intptr_t>&(pod.address)) - (<intptr_t>&pod),
13559 (<intptr_t>&(pod.isParity)) - (<intptr_t>&pod),
13560 (<intptr_t>&(pod.count)) - (<intptr_t>&pod),
13561 ],
13562 'itemsize': sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t),
13563 })
13565ecc_sram_unique_uncorrected_error_entry_v1_dtype = _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets()
13567cdef class EccSramUniqueUncorrectedErrorEntry_v1:
13568 """Empty-initialize an array of `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t`.
13570 The resulting object is of length `size` and of dtype `ecc_sram_unique_uncorrected_error_entry_v1_dtype`.
13571 If default-constructed, the instance represents a single struct.
13573 Args:
13574 size (int): number of structs, default=1.
13577 .. seealso:: `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t`
13578 """
13579 cdef:
13580 readonly object _data
13584 def __init__(self, size=1):
13585 arr = _numpy.empty(size, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype)
13586 self._data = arr.view(_numpy.recarray)
13587 assert self._data.itemsize == sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t), \
13588 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) }"
13590 def __repr__(self):
13591 if self._data.size > 1:
13592 return f"<{__name__}.EccSramUniqueUncorrectedErrorEntry_v1_Array_{self._data.size} object at {hex(id(self))}>"
13593 else:
13594 return f"<{__name__}.EccSramUniqueUncorrectedErrorEntry_v1 object at {hex(id(self))}>"
13596 @property
13597 def ptr(self):
13598 """Get the pointer address to the data as Python :class:`int`."""
13599 return self._data.ctypes.data
13601 cdef intptr_t _get_ptr(self):
13602 return self._data.ctypes.data
13604 def __int__(self):
13605 if self._data.size > 1:
13606 raise TypeError("int() argument must be a bytes-like object of size 1. "
13607 "To get the pointer address of an array, use .ptr")
13608 return self._data.ctypes.data
13610 def __len__(self):
13611 return self._data.size
13613 def __eq__(self, other):
13614 cdef object self_data = self._data
13615 if (not isinstance(other, EccSramUniqueUncorrectedErrorEntry_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
13616 return False
13617 return bool((self_data == other._data).all())
13619 @property
13620 def unit(self):
13621 """Union[~_numpy.uint32, int]: the SRAM unit index"""
13622 if self._data.size == 1:
13623 return int(self._data.unit[0])
13624 return self._data.unit
13626 @unit.setter
13627 def unit(self, val):
13628 self._data.unit = val
13630 @property
13631 def location(self):
13632 """Union[~_numpy.uint32, int]: the error location within the SRAM unit"""
13633 if self._data.size == 1:
13634 return int(self._data.location[0])
13635 return self._data.location
13637 @location.setter
13638 def location(self, val):
13639 self._data.location = val
13641 @property
13642 def sublocation(self):
13643 """Union[~_numpy.uint32, int]: the error sublocation within the SRAM unit"""
13644 if self._data.size == 1:
13645 return int(self._data.sublocation[0])
13646 return self._data.sublocation
13648 @sublocation.setter
13649 def sublocation(self, val):
13650 self._data.sublocation = val
13652 @property
13653 def extlocation(self):
13654 """Union[~_numpy.uint32, int]: the error extlocation within the SRAM unit"""
13655 if self._data.size == 1:
13656 return int(self._data.extlocation[0])
13657 return self._data.extlocation
13659 @extlocation.setter
13660 def extlocation(self, val):
13661 self._data.extlocation = val
13663 @property
13664 def address(self):
13665 """Union[~_numpy.uint32, int]: the error address within the SRAM unit"""
13666 if self._data.size == 1:
13667 return int(self._data.address[0])
13668 return self._data.address
13670 @address.setter
13671 def address(self, val):
13672 self._data.address = val
13674 @property
13675 def is_parity(self):
13676 """Union[~_numpy.uint32, int]: if the SRAM error is parity or not"""
13677 if self._data.size == 1:
13678 return int(self._data.is_parity[0])
13679 return self._data.is_parity
13681 @is_parity.setter
13682 def is_parity(self, val):
13683 self._data.is_parity = val
13685 @property
13686 def count(self):
13687 """Union[~_numpy.uint32, int]: the error count at the same SRAM address"""
13688 if self._data.size == 1:
13689 return int(self._data.count[0])
13690 return self._data.count
13692 @count.setter
13693 def count(self, val):
13694 self._data.count = val
13696 def __getitem__(self, key):
13697 cdef ssize_t key_
13698 cdef ssize_t size
13699 if isinstance(key, int):
13700 key_ = key
13701 size = self._data.size
13702 if key_ >= size or key_ <= -(size+1):
13703 raise IndexError("index is out of bounds")
13704 if key_ < 0:
13705 key_ += size
13706 return EccSramUniqueUncorrectedErrorEntry_v1.from_data(self._data[key_:key_+1])
13707 out = self._data[key]
13708 if isinstance(out, _numpy.recarray) and out.dtype == ecc_sram_unique_uncorrected_error_entry_v1_dtype:
13709 return EccSramUniqueUncorrectedErrorEntry_v1.from_data(out)
13710 return out
13712 def __setitem__(self, key, val):
13713 self._data[key] = val
13715 @staticmethod
13716 def from_data(data):
13717 """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance wrapping the given NumPy array.
13719 Args:
13720 data (_numpy.ndarray): a 1D array of dtype `ecc_sram_unique_uncorrected_error_entry_v1_dtype` holding the data.
13721 """
13722 cdef EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_v1)
13723 if not isinstance(data, _numpy.ndarray):
13724 raise TypeError("data argument must be a NumPy ndarray")
13725 if data.ndim != 1:
13726 raise ValueError("data array must be 1D")
13727 if data.dtype != ecc_sram_unique_uncorrected_error_entry_v1_dtype:
13728 raise ValueError("data array must be of dtype ecc_sram_unique_uncorrected_error_entry_v1_dtype")
13729 obj._data = data.view(_numpy.recarray)
13731 return obj
13733 @staticmethod
13734 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
13735 """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance wrapping the given pointer.
13737 Args:
13738 ptr (intptr_t): pointer address as Python :class:`int` to the data.
13739 size (int): number of structs, default=1.
13740 readonly (bool): whether the data is read-only (to the user). default is `False`.
13741 """
13742 if ptr == 0:
13743 raise ValueError("ptr must not be null (0)")
13744 cdef EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_v1)
13745 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
13746 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
13747 <char*>ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) * size, flag)
13748 data = _numpy.ndarray(size, buffer=buf, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype)
13749 obj._data = data.view(_numpy.recarray)
13751 return obj
13754cdef _get_gpu_fabric_info_v3_dtype_offsets():
13755 cdef nvmlGpuFabricInfo_v3_t pod = nvmlGpuFabricInfo_v3_t()
13756 return _numpy.dtype({
13757 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask', 'health_summary'],
13758 'formats': [_numpy.uint32, (_numpy.uint8, 16), _numpy.int32, _numpy.uint32, _numpy.uint8, _numpy.uint32, _numpy.uint8],
13759 'offsets': [
13760 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
13761 (<intptr_t>&(pod.clusterUuid)) - (<intptr_t>&pod),
13762 (<intptr_t>&(pod.status)) - (<intptr_t>&pod),
13763 (<intptr_t>&(pod.cliqueId)) - (<intptr_t>&pod),
13764 (<intptr_t>&(pod.state)) - (<intptr_t>&pod),
13765 (<intptr_t>&(pod.healthMask)) - (<intptr_t>&pod),
13766 (<intptr_t>&(pod.healthSummary)) - (<intptr_t>&pod),
13767 ],
13768 'itemsize': sizeof(nvmlGpuFabricInfo_v3_t),
13769 })
13771gpu_fabric_info_v3_dtype = _get_gpu_fabric_info_v3_dtype_offsets()
13773cdef class GpuFabricInfo_v3:
13774 """Empty-initialize an instance of `nvmlGpuFabricInfo_v3_t`.
13777 .. seealso:: `nvmlGpuFabricInfo_v3_t`
13778 """
13779 cdef:
13780 nvmlGpuFabricInfo_v3_t *_ptr
13781 object _owner
13782 bint _owned
13783 bint _readonly
13785 def __init__(self):
13786 self._ptr = <nvmlGpuFabricInfo_v3_t *>calloc(1, sizeof(nvmlGpuFabricInfo_v3_t))
13787 if self._ptr == NULL:
13788 raise MemoryError("Error allocating GpuFabricInfo_v3")
13789 self._owner = None
13790 self._owned = True
13791 self._readonly = False
13793 def __dealloc__(self):
13794 cdef nvmlGpuFabricInfo_v3_t *ptr
13795 if self._owned and self._ptr != NULL:
13796 ptr = self._ptr
13797 self._ptr = NULL
13798 free(ptr)
13800 def __repr__(self):
13801 return f"<{__name__}.GpuFabricInfo_v3 object at {hex(id(self))}>"
13803 @property
13804 def ptr(self):
13805 """Get the pointer address to the data as Python :class:`int`."""
13806 return <intptr_t>(self._ptr)
13808 cdef intptr_t _get_ptr(self):
13809 return <intptr_t>(self._ptr)
13811 def __int__(self):
13812 return <intptr_t>(self._ptr)
13814 def __eq__(self, other):
13815 cdef GpuFabricInfo_v3 other_
13816 if not isinstance(other, GpuFabricInfo_v3):
13817 return False
13818 other_ = other
13819 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGpuFabricInfo_v3_t)) == 0)
13821 def __setitem__(self, key, val):
13822 if key == 0 and isinstance(val, _numpy.ndarray):
13823 self._ptr = <nvmlGpuFabricInfo_v3_t *>malloc(sizeof(nvmlGpuFabricInfo_v3_t))
13824 if self._ptr == NULL:
13825 raise MemoryError("Error allocating GpuFabricInfo_v3")
13826 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGpuFabricInfo_v3_t))
13827 self._owner = None
13828 self._owned = True
13829 self._readonly = not val.flags.writeable
13830 else:
13831 setattr(self, key, val)
13833 @property
13834 def version(self):
13835 """int: Structure version identifier (set to nvmlGpuFabricInfo_v2)"""
13836 return self._ptr[0].version
13838 @version.setter
13839 def version(self, val):
13840 if self._readonly:
13841 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13842 self._ptr[0].version = val
13844 @property
13845 def cluster_uuid(self):
13846 """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs."""
13847 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False)
13848 arr.data = <char *>(&(self._ptr[0].clusterUuid))
13849 return _numpy.asarray(arr)
13851 @cluster_uuid.setter
13852 def cluster_uuid(self, val):
13853 if self._readonly:
13854 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13855 if len(val) != 16:
13856 raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}")
13857 cdef view.array arr = view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c")
13858 arr[:] = _numpy.asarray(val, dtype=_numpy.uint8)
13859 memcpy(<void *>(&(self._ptr[0].clusterUuid)), <void *>(arr.data), sizeof(unsigned char) * len(val))
13861 @property
13862 def status(self):
13863 """int: Probe Error status, if any. Must be checked only if Probe state returns "complete"."""
13864 return <int>(self._ptr[0].status)
13866 @status.setter
13867 def status(self, val):
13868 if self._readonly:
13869 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13870 self._ptr[0].status = <nvmlReturn_t><int>val
13872 @property
13873 def clique_id(self):
13874 """int: ID of the fabric clique to which this GPU belongs."""
13875 return self._ptr[0].cliqueId
13877 @clique_id.setter
13878 def clique_id(self, val):
13879 if self._readonly:
13880 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13881 self._ptr[0].cliqueId = val
13883 @property
13884 def state(self):
13885 """int: Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_*."""
13886 return <unsigned char>(self._ptr[0].state)
13888 @state.setter
13889 def state(self, val):
13890 if self._readonly:
13891 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13892 self._ptr[0].state = <nvmlGpuFabricState_t><unsigned char>val
13894 @property
13895 def health_mask(self):
13896 """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*."""
13897 return self._ptr[0].healthMask
13899 @health_mask.setter
13900 def health_mask(self, val):
13901 if self._readonly:
13902 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13903 self._ptr[0].healthMask = val
13905 @property
13906 def health_summary(self):
13907 """int: GPU Fabric health summary. See NVML_GPU_FABRIC_HEALTH_SUMMARY_*."""
13908 return self._ptr[0].healthSummary
13910 @health_summary.setter
13911 def health_summary(self, val):
13912 if self._readonly:
13913 raise ValueError("This GpuFabricInfo_v3 instance is read-only")
13914 self._ptr[0].healthSummary = val
13916 @staticmethod
13917 def from_data(data):
13918 """Create an GpuFabricInfo_v3 instance wrapping the given NumPy array.
13920 Args:
13921 data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v3_dtype` holding the data.
13922 """
13923 return __from_data(data, "gpu_fabric_info_v3_dtype", gpu_fabric_info_v3_dtype, GpuFabricInfo_v3)
13925 @staticmethod
13926 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
13927 """Create an GpuFabricInfo_v3 instance wrapping the given pointer.
13929 Args:
13930 ptr (intptr_t): pointer address as Python :class:`int` to the data.
13931 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
13932 readonly (bool): whether the data is read-only (to the user). default is `False`.
13933 """
13934 if ptr == 0:
13935 raise ValueError("ptr must not be null (0)")
13936 cdef GpuFabricInfo_v3 obj = GpuFabricInfo_v3.__new__(GpuFabricInfo_v3)
13937 if owner is None:
13938 obj._ptr = <nvmlGpuFabricInfo_v3_t *>malloc(sizeof(nvmlGpuFabricInfo_v3_t))
13939 if obj._ptr == NULL:
13940 raise MemoryError("Error allocating GpuFabricInfo_v3")
13941 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGpuFabricInfo_v3_t))
13942 obj._owner = None
13943 obj._owned = True
13944 else:
13945 obj._ptr = <nvmlGpuFabricInfo_v3_t *>ptr
13946 obj._owner = owner
13947 obj._owned = False
13948 obj._readonly = readonly
13949 return obj
13952cdef _get_nv_link_info_v1_dtype_offsets():
13953 cdef nvmlNvLinkInfo_v1_t pod = nvmlNvLinkInfo_v1_t()
13954 return _numpy.dtype({
13955 'names': ['version', 'is_nvle_enabled'],
13956 'formats': [_numpy.uint32, _numpy.uint32],
13957 'offsets': [
13958 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
13959 (<intptr_t>&(pod.isNvleEnabled)) - (<intptr_t>&pod),
13960 ],
13961 'itemsize': sizeof(nvmlNvLinkInfo_v1_t),
13962 })
13964nv_link_info_v1_dtype = _get_nv_link_info_v1_dtype_offsets()
13966cdef class NvLinkInfo_v1:
13967 """Empty-initialize an instance of `nvmlNvLinkInfo_v1_t`.
13970 .. seealso:: `nvmlNvLinkInfo_v1_t`
13971 """
13972 cdef:
13973 nvmlNvLinkInfo_v1_t *_ptr
13974 object _owner
13975 bint _owned
13976 bint _readonly
13978 def __init__(self):
13979 self._ptr = <nvmlNvLinkInfo_v1_t *>calloc(1, sizeof(nvmlNvLinkInfo_v1_t))
13980 if self._ptr == NULL:
13981 raise MemoryError("Error allocating NvLinkInfo_v1")
13982 self._owner = None
13983 self._owned = True
13984 self._readonly = False
13986 def __dealloc__(self):
13987 cdef nvmlNvLinkInfo_v1_t *ptr
13988 if self._owned and self._ptr != NULL:
13989 ptr = self._ptr
13990 self._ptr = NULL
13991 free(ptr)
13993 def __repr__(self):
13994 return f"<{__name__}.NvLinkInfo_v1 object at {hex(id(self))}>"
13996 @property
13997 def ptr(self):
13998 """Get the pointer address to the data as Python :class:`int`."""
13999 return <intptr_t>(self._ptr)
14001 cdef intptr_t _get_ptr(self):
14002 return <intptr_t>(self._ptr)
14004 def __int__(self):
14005 return <intptr_t>(self._ptr)
14007 def __eq__(self, other):
14008 cdef NvLinkInfo_v1 other_
14009 if not isinstance(other, NvLinkInfo_v1):
14010 return False
14011 other_ = other
14012 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvLinkInfo_v1_t)) == 0)
14014 def __setitem__(self, key, val):
14015 if key == 0 and isinstance(val, _numpy.ndarray):
14016 self._ptr = <nvmlNvLinkInfo_v1_t *>malloc(sizeof(nvmlNvLinkInfo_v1_t))
14017 if self._ptr == NULL:
14018 raise MemoryError("Error allocating NvLinkInfo_v1")
14019 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvLinkInfo_v1_t))
14020 self._owner = None
14021 self._owned = True
14022 self._readonly = not val.flags.writeable
14023 else:
14024 setattr(self, key, val)
14026 @property
14027 def version(self):
14028 """int: IN - the API version number."""
14029 return self._ptr[0].version
14031 @version.setter
14032 def version(self, val):
14033 if self._readonly:
14034 raise ValueError("This NvLinkInfo_v1 instance is read-only")
14035 self._ptr[0].version = val
14037 @property
14038 def is_nvle_enabled(self):
14039 """int: OUT - NVLINK encryption enablement."""
14040 return self._ptr[0].isNvleEnabled
14042 @is_nvle_enabled.setter
14043 def is_nvle_enabled(self, val):
14044 if self._readonly:
14045 raise ValueError("This NvLinkInfo_v1 instance is read-only")
14046 self._ptr[0].isNvleEnabled = val
14048 @staticmethod
14049 def from_data(data):
14050 """Create an NvLinkInfo_v1 instance wrapping the given NumPy array.
14052 Args:
14053 data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v1_dtype` holding the data.
14054 """
14055 return __from_data(data, "nv_link_info_v1_dtype", nv_link_info_v1_dtype, NvLinkInfo_v1)
14057 @staticmethod
14058 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
14059 """Create an NvLinkInfo_v1 instance wrapping the given pointer.
14061 Args:
14062 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14063 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
14064 readonly (bool): whether the data is read-only (to the user). default is `False`.
14065 """
14066 if ptr == 0:
14067 raise ValueError("ptr must not be null (0)")
14068 cdef NvLinkInfo_v1 obj = NvLinkInfo_v1.__new__(NvLinkInfo_v1)
14069 if owner is None:
14070 obj._ptr = <nvmlNvLinkInfo_v1_t *>malloc(sizeof(nvmlNvLinkInfo_v1_t))
14071 if obj._ptr == NULL:
14072 raise MemoryError("Error allocating NvLinkInfo_v1")
14073 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvLinkInfo_v1_t))
14074 obj._owner = None
14075 obj._owned = True
14076 else:
14077 obj._ptr = <nvmlNvLinkInfo_v1_t *>ptr
14078 obj._owner = owner
14079 obj._owned = False
14080 obj._readonly = readonly
14081 return obj
14084cdef _get_nvlink_firmware_version_dtype_offsets():
14085 cdef nvmlNvlinkFirmwareVersion_t pod = nvmlNvlinkFirmwareVersion_t()
14086 return _numpy.dtype({
14087 'names': ['ucode_type', 'major', 'minor', 'sub_minor'],
14088 'formats': [_numpy.uint8, _numpy.uint32, _numpy.uint32, _numpy.uint32],
14089 'offsets': [
14090 (<intptr_t>&(pod.ucodeType)) - (<intptr_t>&pod),
14091 (<intptr_t>&(pod.major)) - (<intptr_t>&pod),
14092 (<intptr_t>&(pod.minor)) - (<intptr_t>&pod),
14093 (<intptr_t>&(pod.subMinor)) - (<intptr_t>&pod),
14094 ],
14095 'itemsize': sizeof(nvmlNvlinkFirmwareVersion_t),
14096 })
14098nvlink_firmware_version_dtype = _get_nvlink_firmware_version_dtype_offsets()
14100cdef class NvlinkFirmwareVersion:
14101 """Empty-initialize an instance of `nvmlNvlinkFirmwareVersion_t`.
14104 .. seealso:: `nvmlNvlinkFirmwareVersion_t`
14105 """
14106 cdef:
14107 nvmlNvlinkFirmwareVersion_t *_ptr
14108 object _owner
14109 bint _owned
14110 bint _readonly
14112 def __init__(self):
14113 self._ptr = <nvmlNvlinkFirmwareVersion_t *>calloc(1, sizeof(nvmlNvlinkFirmwareVersion_t))
14114 if self._ptr == NULL:
14115 raise MemoryError("Error allocating NvlinkFirmwareVersion")
14116 self._owner = None
14117 self._owned = True
14118 self._readonly = False
14120 def __dealloc__(self):
14121 cdef nvmlNvlinkFirmwareVersion_t *ptr
14122 if self._owned and self._ptr != NULL:
14123 ptr = self._ptr
14124 self._ptr = NULL
14125 free(ptr)
14127 def __repr__(self):
14128 return f"<{__name__}.NvlinkFirmwareVersion object at {hex(id(self))}>"
14130 @property
14131 def ptr(self):
14132 """Get the pointer address to the data as Python :class:`int`."""
14133 return <intptr_t>(self._ptr)
14135 cdef intptr_t _get_ptr(self):
14136 return <intptr_t>(self._ptr)
14138 def __int__(self):
14139 return <intptr_t>(self._ptr)
14141 def __eq__(self, other):
14142 cdef NvlinkFirmwareVersion other_
14143 if not isinstance(other, NvlinkFirmwareVersion):
14144 return False
14145 other_ = other
14146 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvlinkFirmwareVersion_t)) == 0)
14148 def __setitem__(self, key, val):
14149 if key == 0 and isinstance(val, _numpy.ndarray):
14150 self._ptr = <nvmlNvlinkFirmwareVersion_t *>malloc(sizeof(nvmlNvlinkFirmwareVersion_t))
14151 if self._ptr == NULL:
14152 raise MemoryError("Error allocating NvlinkFirmwareVersion")
14153 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvlinkFirmwareVersion_t))
14154 self._owner = None
14155 self._owned = True
14156 self._readonly = not val.flags.writeable
14157 else:
14158 setattr(self, key, val)
14160 @property
14161 def ucode_type(self):
14162 """int: """
14163 return self._ptr[0].ucodeType
14165 @ucode_type.setter
14166 def ucode_type(self, val):
14167 if self._readonly:
14168 raise ValueError("This NvlinkFirmwareVersion instance is read-only")
14169 self._ptr[0].ucodeType = val
14171 @property
14172 def major(self):
14173 """int: """
14174 return self._ptr[0].major
14176 @major.setter
14177 def major(self, val):
14178 if self._readonly:
14179 raise ValueError("This NvlinkFirmwareVersion instance is read-only")
14180 self._ptr[0].major = val
14182 @property
14183 def minor(self):
14184 """int: """
14185 return self._ptr[0].minor
14187 @minor.setter
14188 def minor(self, val):
14189 if self._readonly:
14190 raise ValueError("This NvlinkFirmwareVersion instance is read-only")
14191 self._ptr[0].minor = val
14193 @property
14194 def sub_minor(self):
14195 """int: """
14196 return self._ptr[0].subMinor
14198 @sub_minor.setter
14199 def sub_minor(self, val):
14200 if self._readonly:
14201 raise ValueError("This NvlinkFirmwareVersion instance is read-only")
14202 self._ptr[0].subMinor = val
14204 @staticmethod
14205 def from_data(data):
14206 """Create an NvlinkFirmwareVersion instance wrapping the given NumPy array.
14208 Args:
14209 data (_numpy.ndarray): a single-element array of dtype `nvlink_firmware_version_dtype` holding the data.
14210 """
14211 return __from_data(data, "nvlink_firmware_version_dtype", nvlink_firmware_version_dtype, NvlinkFirmwareVersion)
14213 @staticmethod
14214 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
14215 """Create an NvlinkFirmwareVersion instance wrapping the given pointer.
14217 Args:
14218 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14219 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
14220 readonly (bool): whether the data is read-only (to the user). default is `False`.
14221 """
14222 if ptr == 0:
14223 raise ValueError("ptr must not be null (0)")
14224 cdef NvlinkFirmwareVersion obj = NvlinkFirmwareVersion.__new__(NvlinkFirmwareVersion)
14225 if owner is None:
14226 obj._ptr = <nvmlNvlinkFirmwareVersion_t *>malloc(sizeof(nvmlNvlinkFirmwareVersion_t))
14227 if obj._ptr == NULL:
14228 raise MemoryError("Error allocating NvlinkFirmwareVersion")
14229 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvlinkFirmwareVersion_t))
14230 obj._owner = None
14231 obj._owned = True
14232 else:
14233 obj._ptr = <nvmlNvlinkFirmwareVersion_t *>ptr
14234 obj._owner = owner
14235 obj._owned = False
14236 obj._readonly = readonly
14237 return obj
14240cdef _get_prm_counter_input_v1_dtype_offsets():
14241 cdef nvmlPRMCounterInput_v1_t pod = nvmlPRMCounterInput_v1_t()
14242 return _numpy.dtype({
14243 'names': ['local_port'],
14244 'formats': [_numpy.uint32],
14245 'offsets': [
14246 (<intptr_t>&(pod.localPort)) - (<intptr_t>&pod),
14247 ],
14248 'itemsize': sizeof(nvmlPRMCounterInput_v1_t),
14249 })
14251prm_counter_input_v1_dtype = _get_prm_counter_input_v1_dtype_offsets()
14253cdef class PRMCounterInput_v1:
14254 """Empty-initialize an instance of `nvmlPRMCounterInput_v1_t`.
14257 .. seealso:: `nvmlPRMCounterInput_v1_t`
14258 """
14259 cdef:
14260 nvmlPRMCounterInput_v1_t *_ptr
14261 object _owner
14262 bint _owned
14263 bint _readonly
14265 def __init__(self):
14266 self._ptr = <nvmlPRMCounterInput_v1_t *>calloc(1, sizeof(nvmlPRMCounterInput_v1_t))
14267 if self._ptr == NULL:
14268 raise MemoryError("Error allocating PRMCounterInput_v1")
14269 self._owner = None
14270 self._owned = True
14271 self._readonly = False
14273 def __dealloc__(self):
14274 cdef nvmlPRMCounterInput_v1_t *ptr
14275 if self._owned and self._ptr != NULL:
14276 ptr = self._ptr
14277 self._ptr = NULL
14278 free(ptr)
14280 def __repr__(self):
14281 return f"<{__name__}.PRMCounterInput_v1 object at {hex(id(self))}>"
14283 @property
14284 def ptr(self):
14285 """Get the pointer address to the data as Python :class:`int`."""
14286 return <intptr_t>(self._ptr)
14288 cdef intptr_t _get_ptr(self):
14289 return <intptr_t>(self._ptr)
14291 def __int__(self):
14292 return <intptr_t>(self._ptr)
14294 def __eq__(self, other):
14295 cdef PRMCounterInput_v1 other_
14296 if not isinstance(other, PRMCounterInput_v1):
14297 return False
14298 other_ = other
14299 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPRMCounterInput_v1_t)) == 0)
14301 def __setitem__(self, key, val):
14302 if key == 0 and isinstance(val, _numpy.ndarray):
14303 self._ptr = <nvmlPRMCounterInput_v1_t *>malloc(sizeof(nvmlPRMCounterInput_v1_t))
14304 if self._ptr == NULL:
14305 raise MemoryError("Error allocating PRMCounterInput_v1")
14306 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPRMCounterInput_v1_t))
14307 self._owner = None
14308 self._owned = True
14309 self._readonly = not val.flags.writeable
14310 else:
14311 setattr(self, key, val)
14313 @property
14314 def local_port(self):
14315 """int: Local port number."""
14316 return self._ptr[0].localPort
14318 @local_port.setter
14319 def local_port(self, val):
14320 if self._readonly:
14321 raise ValueError("This PRMCounterInput_v1 instance is read-only")
14322 self._ptr[0].localPort = val
14324 @staticmethod
14325 def from_data(data):
14326 """Create an PRMCounterInput_v1 instance wrapping the given NumPy array.
14328 Args:
14329 data (_numpy.ndarray): a single-element array of dtype `prm_counter_input_v1_dtype` holding the data.
14330 """
14331 return __from_data(data, "prm_counter_input_v1_dtype", prm_counter_input_v1_dtype, PRMCounterInput_v1)
14333 @staticmethod
14334 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
14335 """Create an PRMCounterInput_v1 instance wrapping the given pointer.
14337 Args:
14338 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14339 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
14340 readonly (bool): whether the data is read-only (to the user). default is `False`.
14341 """
14342 if ptr == 0:
14343 raise ValueError("ptr must not be null (0)")
14344 cdef PRMCounterInput_v1 obj = PRMCounterInput_v1.__new__(PRMCounterInput_v1)
14345 if owner is None:
14346 obj._ptr = <nvmlPRMCounterInput_v1_t *>malloc(sizeof(nvmlPRMCounterInput_v1_t))
14347 if obj._ptr == NULL:
14348 raise MemoryError("Error allocating PRMCounterInput_v1")
14349 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPRMCounterInput_v1_t))
14350 obj._owner = None
14351 obj._owned = True
14352 else:
14353 obj._ptr = <nvmlPRMCounterInput_v1_t *>ptr
14354 obj._owner = owner
14355 obj._owned = False
14356 obj._readonly = readonly
14357 return obj
14360cdef _get_excluded_device_info_dtype_offsets():
14361 cdef nvmlExcludedDeviceInfo_t pod = nvmlExcludedDeviceInfo_t()
14362 return _numpy.dtype({
14363 'names': ['pci_info', 'uuid'],
14364 'formats': [pci_info_dtype, (_numpy.int8, 80)],
14365 'offsets': [
14366 (<intptr_t>&(pod.pciInfo)) - (<intptr_t>&pod),
14367 (<intptr_t>&(pod.uuid)) - (<intptr_t>&pod),
14368 ],
14369 'itemsize': sizeof(nvmlExcludedDeviceInfo_t),
14370 })
14372excluded_device_info_dtype = _get_excluded_device_info_dtype_offsets()
14374cdef class ExcludedDeviceInfo:
14375 """Empty-initialize an instance of `nvmlExcludedDeviceInfo_t`.
14378 .. seealso:: `nvmlExcludedDeviceInfo_t`
14379 """
14380 cdef:
14381 nvmlExcludedDeviceInfo_t *_ptr
14382 object _owner
14383 bint _owned
14384 bint _readonly
14386 def __init__(self):
14387 self._ptr = <nvmlExcludedDeviceInfo_t *>calloc(1, sizeof(nvmlExcludedDeviceInfo_t))
14388 if self._ptr == NULL:
14389 raise MemoryError("Error allocating ExcludedDeviceInfo")
14390 self._owner = None
14391 self._owned = True
14392 self._readonly = False
14394 def __dealloc__(self):
14395 cdef nvmlExcludedDeviceInfo_t *ptr
14396 if self._owned and self._ptr != NULL:
14397 ptr = self._ptr
14398 self._ptr = NULL
14399 free(ptr)
14401 def __repr__(self):
14402 return f"<{__name__}.ExcludedDeviceInfo object at {hex(id(self))}>"
14404 @property
14405 def ptr(self):
14406 """Get the pointer address to the data as Python :class:`int`."""
14407 return <intptr_t>(self._ptr)
14409 cdef intptr_t _get_ptr(self):
14410 return <intptr_t>(self._ptr)
14412 def __int__(self):
14413 return <intptr_t>(self._ptr)
14415 def __eq__(self, other):
14416 cdef ExcludedDeviceInfo other_
14417 if not isinstance(other, ExcludedDeviceInfo):
14418 return False
14419 other_ = other
14420 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlExcludedDeviceInfo_t)) == 0)
14422 def __setitem__(self, key, val):
14423 if key == 0 and isinstance(val, _numpy.ndarray):
14424 self._ptr = <nvmlExcludedDeviceInfo_t *>malloc(sizeof(nvmlExcludedDeviceInfo_t))
14425 if self._ptr == NULL:
14426 raise MemoryError("Error allocating ExcludedDeviceInfo")
14427 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlExcludedDeviceInfo_t))
14428 self._owner = None
14429 self._owned = True
14430 self._readonly = not val.flags.writeable
14431 else:
14432 setattr(self, key, val)
14434 @property
14435 def pci_info(self):
14436 """PciInfo: """
14437 return PciInfo.from_ptr(<intptr_t>&(self._ptr[0].pciInfo), self._readonly, self)
14439 @pci_info.setter
14440 def pci_info(self, val):
14441 if self._readonly:
14442 raise ValueError("This ExcludedDeviceInfo instance is read-only")
14443 cdef PciInfo val_ = val
14444 memcpy(<void *>&(self._ptr[0].pciInfo), <void *>(val_._get_ptr()), sizeof(nvmlPciInfo_t) * 1)
14446 @property
14447 def uuid(self):
14448 """~_numpy.int8: (array of length 80)."""
14449 return cpython.PyUnicode_FromString(self._ptr[0].uuid)
14451 @uuid.setter
14452 def uuid(self, val):
14453 if self._readonly:
14454 raise ValueError("This ExcludedDeviceInfo instance is read-only")
14455 cdef bytes buf = val.encode()
14456 if len(buf) >= 80:
14457 raise ValueError("String too long for field uuid, max length is 79")
14458 cdef char *ptr = buf
14459 memcpy(<void *>(self._ptr[0].uuid), <void *>ptr, 80)
14461 @staticmethod
14462 def from_data(data):
14463 """Create an ExcludedDeviceInfo instance wrapping the given NumPy array.
14465 Args:
14466 data (_numpy.ndarray): a single-element array of dtype `excluded_device_info_dtype` holding the data.
14467 """
14468 return __from_data(data, "excluded_device_info_dtype", excluded_device_info_dtype, ExcludedDeviceInfo)
14470 @staticmethod
14471 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
14472 """Create an ExcludedDeviceInfo instance wrapping the given pointer.
14474 Args:
14475 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14476 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
14477 readonly (bool): whether the data is read-only (to the user). default is `False`.
14478 """
14479 if ptr == 0:
14480 raise ValueError("ptr must not be null (0)")
14481 cdef ExcludedDeviceInfo obj = ExcludedDeviceInfo.__new__(ExcludedDeviceInfo)
14482 if owner is None:
14483 obj._ptr = <nvmlExcludedDeviceInfo_t *>malloc(sizeof(nvmlExcludedDeviceInfo_t))
14484 if obj._ptr == NULL:
14485 raise MemoryError("Error allocating ExcludedDeviceInfo")
14486 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlExcludedDeviceInfo_t))
14487 obj._owner = None
14488 obj._owned = True
14489 else:
14490 obj._ptr = <nvmlExcludedDeviceInfo_t *>ptr
14491 obj._owner = owner
14492 obj._owned = False
14493 obj._readonly = readonly
14494 return obj
14497cdef _get_process_detail_list_v1_dtype_offsets():
14498 cdef nvmlProcessDetailList_v1_t pod = nvmlProcessDetailList_v1_t()
14499 return _numpy.dtype({
14500 'names': ['version', 'mode', 'num_proc_array_entries', 'proc_array'],
14501 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp],
14502 'offsets': [
14503 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
14504 (<intptr_t>&(pod.mode)) - (<intptr_t>&pod),
14505 (<intptr_t>&(pod.numProcArrayEntries)) - (<intptr_t>&pod),
14506 (<intptr_t>&(pod.procArray)) - (<intptr_t>&pod),
14507 ],
14508 'itemsize': sizeof(nvmlProcessDetailList_v1_t),
14509 })
14511process_detail_list_v1_dtype = _get_process_detail_list_v1_dtype_offsets()
14513cdef class ProcessDetailList_v1:
14514 """Empty-initialize an instance of `nvmlProcessDetailList_v1_t`.
14517 .. seealso:: `nvmlProcessDetailList_v1_t`
14518 """
14519 cdef:
14520 nvmlProcessDetailList_v1_t *_ptr
14521 object _owner
14522 bint _owned
14523 bint _readonly
14524 dict _refs
14526 def __init__(self):
14527 self._ptr = <nvmlProcessDetailList_v1_t *>calloc(1, sizeof(nvmlProcessDetailList_v1_t))
14528 if self._ptr == NULL:
14529 raise MemoryError("Error allocating ProcessDetailList_v1")
14530 self._owner = None
14531 self._owned = True
14532 self._readonly = False
14533 self._refs = {}
14535 def __dealloc__(self):
14536 cdef nvmlProcessDetailList_v1_t *ptr
14537 if self._owned and self._ptr != NULL:
14538 ptr = self._ptr
14539 self._ptr = NULL
14540 free(ptr)
14542 def __repr__(self):
14543 return f"<{__name__}.ProcessDetailList_v1 object at {hex(id(self))}>"
14545 @property
14546 def ptr(self):
14547 """Get the pointer address to the data as Python :class:`int`."""
14548 return <intptr_t>(self._ptr)
14550 cdef intptr_t _get_ptr(self):
14551 return <intptr_t>(self._ptr)
14553 def __int__(self):
14554 return <intptr_t>(self._ptr)
14556 def __eq__(self, other):
14557 cdef ProcessDetailList_v1 other_
14558 if not isinstance(other, ProcessDetailList_v1):
14559 return False
14560 other_ = other
14561 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlProcessDetailList_v1_t)) == 0)
14563 def __setitem__(self, key, val):
14564 if key == 0 and isinstance(val, _numpy.ndarray):
14565 self._ptr = <nvmlProcessDetailList_v1_t *>malloc(sizeof(nvmlProcessDetailList_v1_t))
14566 if self._ptr == NULL:
14567 raise MemoryError("Error allocating ProcessDetailList_v1")
14568 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlProcessDetailList_v1_t))
14569 self._owner = None
14570 self._owned = True
14571 self._readonly = not val.flags.writeable
14572 else:
14573 setattr(self, key, val)
14575 @property
14576 def version(self):
14577 """int: Struct version, MUST be nvmlProcessDetailList_v1."""
14578 return self._ptr[0].version
14580 @version.setter
14581 def version(self, val):
14582 if self._readonly:
14583 raise ValueError("This ProcessDetailList_v1 instance is read-only")
14584 self._ptr[0].version = val
14586 @property
14587 def mode(self):
14588 """int: Process mode(Compute/Graphics/MPSCompute)"""
14589 return self._ptr[0].mode
14591 @mode.setter
14592 def mode(self, val):
14593 if self._readonly:
14594 raise ValueError("This ProcessDetailList_v1 instance is read-only")
14595 self._ptr[0].mode = val
14597 @property
14598 def proc_array(self):
14599 """int: Process array."""
14600 if self._ptr[0].procArray == NULL or self._ptr[0].numProcArrayEntries == 0:
14601 return []
14602 return ProcessDetail_v1.from_ptr(<intptr_t>(self._ptr[0].procArray), self._ptr[0].numProcArrayEntries)
14604 @proc_array.setter
14605 def proc_array(self, val):
14606 if self._readonly:
14607 raise ValueError("This ProcessDetailList_v1 instance is read-only")
14608 cdef ProcessDetail_v1 arr = val
14609 self._ptr[0].procArray = <nvmlProcessDetail_v1_t*><intptr_t>(arr._get_ptr())
14610 self._ptr[0].numProcArrayEntries = len(arr)
14611 self._refs["proc_array"] = arr
14613 @staticmethod
14614 def from_data(data):
14615 """Create an ProcessDetailList_v1 instance wrapping the given NumPy array.
14617 Args:
14618 data (_numpy.ndarray): a single-element array of dtype `process_detail_list_v1_dtype` holding the data.
14619 """
14620 return __from_data(data, "process_detail_list_v1_dtype", process_detail_list_v1_dtype, ProcessDetailList_v1)
14622 @staticmethod
14623 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
14624 """Create an ProcessDetailList_v1 instance wrapping the given pointer.
14626 Args:
14627 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14628 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
14629 readonly (bool): whether the data is read-only (to the user). default is `False`.
14630 """
14631 if ptr == 0:
14632 raise ValueError("ptr must not be null (0)")
14633 cdef ProcessDetailList_v1 obj = ProcessDetailList_v1.__new__(ProcessDetailList_v1)
14634 if owner is None:
14635 obj._ptr = <nvmlProcessDetailList_v1_t *>malloc(sizeof(nvmlProcessDetailList_v1_t))
14636 if obj._ptr == NULL:
14637 raise MemoryError("Error allocating ProcessDetailList_v1")
14638 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlProcessDetailList_v1_t))
14639 obj._owner = None
14640 obj._owned = True
14641 else:
14642 obj._ptr = <nvmlProcessDetailList_v1_t *>ptr
14643 obj._owner = owner
14644 obj._owned = False
14645 obj._readonly = readonly
14646 obj._refs = {}
14647 return obj
14650cdef _get_bridge_chip_hierarchy_dtype_offsets():
14651 cdef nvmlBridgeChipHierarchy_t pod = nvmlBridgeChipHierarchy_t()
14652 return _numpy.dtype({
14653 'names': ['bridge_count', 'bridge_chip_info'],
14654 'formats': [_numpy.uint8, (bridge_chip_info_dtype, 128)],
14655 'offsets': [
14656 (<intptr_t>&(pod.bridgeCount)) - (<intptr_t>&pod),
14657 (<intptr_t>&(pod.bridgeChipInfo)) - (<intptr_t>&pod),
14658 ],
14659 'itemsize': sizeof(nvmlBridgeChipHierarchy_t),
14660 })
14662bridge_chip_hierarchy_dtype = _get_bridge_chip_hierarchy_dtype_offsets()
14664cdef class BridgeChipHierarchy:
14665 """Empty-initialize an instance of `nvmlBridgeChipHierarchy_t`.
14668 .. seealso:: `nvmlBridgeChipHierarchy_t`
14669 """
14670 cdef:
14671 nvmlBridgeChipHierarchy_t *_ptr
14672 object _owner
14673 bint _owned
14674 bint _readonly
14676 def __init__(self):
14677 self._ptr = <nvmlBridgeChipHierarchy_t *>calloc(1, sizeof(nvmlBridgeChipHierarchy_t)) 12s
14678 if self._ptr == NULL: 12s
14679 raise MemoryError("Error allocating BridgeChipHierarchy")
14680 self._owner = None 12s
14681 self._owned = True 12s
14682 self._readonly = False 12s
14684 def __dealloc__(self):
14685 cdef nvmlBridgeChipHierarchy_t *ptr
14686 if self._owned and self._ptr != NULL: 12s
14687 ptr = self._ptr 12s
14688 self._ptr = NULL 12s
14689 free(ptr) 12s
14691 def __repr__(self):
14692 return f"<{__name__}.BridgeChipHierarchy object at {hex(id(self))}>"
14694 @property
14695 def ptr(self):
14696 """Get the pointer address to the data as Python :class:`int`."""
14697 return <intptr_t>(self._ptr)
14699 cdef intptr_t _get_ptr(self):
14700 return <intptr_t>(self._ptr) 1s
14702 def __int__(self):
14703 return <intptr_t>(self._ptr)
14705 def __eq__(self, other):
14706 cdef BridgeChipHierarchy other_
14707 if not isinstance(other, BridgeChipHierarchy):
14708 return False
14709 other_ = other
14710 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlBridgeChipHierarchy_t)) == 0)
14712 def __setitem__(self, key, val):
14713 if key == 0 and isinstance(val, _numpy.ndarray):
14714 self._ptr = <nvmlBridgeChipHierarchy_t *>malloc(sizeof(nvmlBridgeChipHierarchy_t))
14715 if self._ptr == NULL:
14716 raise MemoryError("Error allocating BridgeChipHierarchy")
14717 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlBridgeChipHierarchy_t))
14718 self._owner = None
14719 self._owned = True
14720 self._readonly = not val.flags.writeable
14721 else:
14722 setattr(self, key, val)
14724 @property
14725 def bridge_chip_info(self):
14726 """BridgeChipInfo: """
14727 return BridgeChipInfo.from_ptr(<intptr_t>&(self._ptr[0].bridgeChipInfo), self._ptr[0].bridgeCount, self._readonly) 12
14729 @bridge_chip_info.setter
14730 def bridge_chip_info(self, val):
14731 if self._readonly:
14732 raise ValueError("This BridgeChipHierarchy instance is read-only")
14733 cdef BridgeChipInfo val_ = val
14734 if len(val) > 128:
14735 raise ValueError(f"Expected length < 128 for field bridge_chip_info, got {len(val)}")
14736 self._ptr[0].bridgeCount = len(val)
14737 if len(val) == 0:
14738 return
14739 memcpy(<void *>&(self._ptr[0].bridgeChipInfo), <void *>(val_._get_ptr()), sizeof(nvmlBridgeChipInfo_t) * self._ptr[0].bridgeCount)
14741 @staticmethod
14742 def from_data(data):
14743 """Create an BridgeChipHierarchy instance wrapping the given NumPy array.
14745 Args:
14746 data (_numpy.ndarray): a single-element array of dtype `bridge_chip_hierarchy_dtype` holding the data.
14747 """
14748 return __from_data(data, "bridge_chip_hierarchy_dtype", bridge_chip_hierarchy_dtype, BridgeChipHierarchy)
14750 @staticmethod
14751 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
14752 """Create an BridgeChipHierarchy instance wrapping the given pointer.
14754 Args:
14755 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14756 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
14757 readonly (bool): whether the data is read-only (to the user). default is `False`.
14758 """
14759 if ptr == 0:
14760 raise ValueError("ptr must not be null (0)")
14761 cdef BridgeChipHierarchy obj = BridgeChipHierarchy.__new__(BridgeChipHierarchy)
14762 if owner is None:
14763 obj._ptr = <nvmlBridgeChipHierarchy_t *>malloc(sizeof(nvmlBridgeChipHierarchy_t))
14764 if obj._ptr == NULL:
14765 raise MemoryError("Error allocating BridgeChipHierarchy")
14766 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlBridgeChipHierarchy_t))
14767 obj._owner = None
14768 obj._owned = True
14769 else:
14770 obj._ptr = <nvmlBridgeChipHierarchy_t *>ptr
14771 obj._owner = owner
14772 obj._owned = False
14773 obj._readonly = readonly
14774 return obj
14777cdef _get_sample_dtype_offsets():
14778 cdef nvmlSample_t pod = nvmlSample_t()
14779 return _numpy.dtype({
14780 'names': ['time_stamp', 'sample_value'],
14781 'formats': [_numpy.uint64, value_dtype],
14782 'offsets': [
14783 (<intptr_t>&(pod.timeStamp)) - (<intptr_t>&pod),
14784 (<intptr_t>&(pod.sampleValue)) - (<intptr_t>&pod),
14785 ],
14786 'itemsize': sizeof(nvmlSample_t),
14787 })
14789sample_dtype = _get_sample_dtype_offsets()
14791cdef class Sample:
14792 """Empty-initialize an array of `nvmlSample_t`.
14794 The resulting object is of length `size` and of dtype `sample_dtype`.
14795 If default-constructed, the instance represents a single struct.
14797 Args:
14798 size (int): number of structs, default=1.
14801 .. seealso:: `nvmlSample_t`
14802 """
14803 cdef:
14804 readonly object _data
14808 def __init__(self, size=1):
14809 arr = _numpy.empty(size, dtype=sample_dtype)
14810 self._data = arr.view(_numpy.recarray)
14811 assert self._data.itemsize == sizeof(nvmlSample_t), \
14812 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlSample_t) }"
14814 def __repr__(self):
14815 if self._data.size > 1:
14816 return f"<{__name__}.Sample_Array_{self._data.size} object at {hex(id(self))}>"
14817 else:
14818 return f"<{__name__}.Sample object at {hex(id(self))}>"
14820 @property
14821 def ptr(self):
14822 """Get the pointer address to the data as Python :class:`int`."""
14823 return self._data.ctypes.data
14825 cdef intptr_t _get_ptr(self):
14826 return self._data.ctypes.data
14828 def __int__(self):
14829 if self._data.size > 1:
14830 raise TypeError("int() argument must be a bytes-like object of size 1. "
14831 "To get the pointer address of an array, use .ptr")
14832 return self._data.ctypes.data
14834 def __len__(self):
14835 return self._data.size
14837 def __eq__(self, other):
14838 cdef object self_data = self._data
14839 if (not isinstance(other, Sample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
14840 return False
14841 return bool((self_data == other._data).all())
14843 @property
14844 def time_stamp(self):
14845 """Union[~_numpy.uint64, int]: """
14846 if self._data.size == 1:
14847 return int(self._data.time_stamp[0])
14848 return self._data.time_stamp
14850 @time_stamp.setter
14851 def time_stamp(self, val):
14852 self._data.time_stamp = val
14854 @property
14855 def sample_value(self):
14856 """value_dtype: """
14857 return self._data.sample_value
14859 @sample_value.setter
14860 def sample_value(self, val):
14861 self._data.sample_value = val
14863 def __getitem__(self, key):
14864 cdef ssize_t key_
14865 cdef ssize_t size
14866 if isinstance(key, int):
14867 key_ = key
14868 size = self._data.size
14869 if key_ >= size or key_ <= -(size+1):
14870 raise IndexError("index is out of bounds")
14871 if key_ < 0:
14872 key_ += size
14873 return Sample.from_data(self._data[key_:key_+1])
14874 out = self._data[key]
14875 if isinstance(out, _numpy.recarray) and out.dtype == sample_dtype:
14876 return Sample.from_data(out)
14877 return out
14879 def __setitem__(self, key, val):
14880 self._data[key] = val
14882 @staticmethod
14883 def from_data(data):
14884 """Create an Sample instance wrapping the given NumPy array.
14886 Args:
14887 data (_numpy.ndarray): a 1D array of dtype `sample_dtype` holding the data.
14888 """
14889 cdef Sample obj = Sample.__new__(Sample)
14890 if not isinstance(data, _numpy.ndarray):
14891 raise TypeError("data argument must be a NumPy ndarray")
14892 if data.ndim != 1:
14893 raise ValueError("data array must be 1D")
14894 if data.dtype != sample_dtype:
14895 raise ValueError("data array must be of dtype sample_dtype")
14896 obj._data = data.view(_numpy.recarray)
14898 return obj
14900 @staticmethod
14901 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
14902 """Create an Sample instance wrapping the given pointer.
14904 Args:
14905 ptr (intptr_t): pointer address as Python :class:`int` to the data.
14906 size (int): number of structs, default=1.
14907 readonly (bool): whether the data is read-only (to the user). default is `False`.
14908 """
14909 if ptr == 0:
14910 raise ValueError("ptr must not be null (0)")
14911 cdef Sample obj = Sample.__new__(Sample)
14912 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
14913 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
14914 <char*>ptr, sizeof(nvmlSample_t) * size, flag)
14915 data = _numpy.ndarray(size, buffer=buf, dtype=sample_dtype)
14916 obj._data = data.view(_numpy.recarray)
14918 return obj
14921cdef _get_vgpu_instance_utilization_sample_dtype_offsets():
14922 cdef nvmlVgpuInstanceUtilizationSample_t pod = nvmlVgpuInstanceUtilizationSample_t()
14923 return _numpy.dtype({
14924 'names': ['vgpu_instance', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'],
14925 'formats': [_numpy.uint32, _numpy.uint64, value_dtype, value_dtype, value_dtype, value_dtype],
14926 'offsets': [
14927 (<intptr_t>&(pod.vgpuInstance)) - (<intptr_t>&pod),
14928 (<intptr_t>&(pod.timeStamp)) - (<intptr_t>&pod),
14929 (<intptr_t>&(pod.smUtil)) - (<intptr_t>&pod),
14930 (<intptr_t>&(pod.memUtil)) - (<intptr_t>&pod),
14931 (<intptr_t>&(pod.encUtil)) - (<intptr_t>&pod),
14932 (<intptr_t>&(pod.decUtil)) - (<intptr_t>&pod),
14933 ],
14934 'itemsize': sizeof(nvmlVgpuInstanceUtilizationSample_t),
14935 })
14937vgpu_instance_utilization_sample_dtype = _get_vgpu_instance_utilization_sample_dtype_offsets()
14939cdef class VgpuInstanceUtilizationSample:
14940 """Empty-initialize an array of `nvmlVgpuInstanceUtilizationSample_t`.
14942 The resulting object is of length `size` and of dtype `vgpu_instance_utilization_sample_dtype`.
14943 If default-constructed, the instance represents a single struct.
14945 Args:
14946 size (int): number of structs, default=1.
14949 .. seealso:: `nvmlVgpuInstanceUtilizationSample_t`
14950 """
14951 cdef:
14952 readonly object _data
14956 def __init__(self, size=1):
14957 arr = _numpy.empty(size, dtype=vgpu_instance_utilization_sample_dtype)
14958 self._data = arr.view(_numpy.recarray)
14959 assert self._data.itemsize == sizeof(nvmlVgpuInstanceUtilizationSample_t), \
14960 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuInstanceUtilizationSample_t) }"
14962 def __repr__(self):
14963 if self._data.size > 1:
14964 return f"<{__name__}.VgpuInstanceUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>"
14965 else:
14966 return f"<{__name__}.VgpuInstanceUtilizationSample object at {hex(id(self))}>"
14968 @property
14969 def ptr(self):
14970 """Get the pointer address to the data as Python :class:`int`."""
14971 return self._data.ctypes.data
14973 cdef intptr_t _get_ptr(self):
14974 return self._data.ctypes.data
14976 def __int__(self):
14977 if self._data.size > 1:
14978 raise TypeError("int() argument must be a bytes-like object of size 1. "
14979 "To get the pointer address of an array, use .ptr")
14980 return self._data.ctypes.data
14982 def __len__(self):
14983 return self._data.size
14985 def __eq__(self, other):
14986 cdef object self_data = self._data
14987 if (not isinstance(other, VgpuInstanceUtilizationSample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
14988 return False
14989 return bool((self_data == other._data).all())
14991 @property
14992 def vgpu_instance(self):
14993 """Union[~_numpy.uint32, int]: """
14994 if self._data.size == 1:
14995 return int(self._data.vgpu_instance[0])
14996 return self._data.vgpu_instance
14998 @vgpu_instance.setter
14999 def vgpu_instance(self, val):
15000 self._data.vgpu_instance = val
15002 @property
15003 def time_stamp(self):
15004 """Union[~_numpy.uint64, int]: """
15005 if self._data.size == 1:
15006 return int(self._data.time_stamp[0])
15007 return self._data.time_stamp
15009 @time_stamp.setter
15010 def time_stamp(self, val):
15011 self._data.time_stamp = val
15013 @property
15014 def sm_util(self):
15015 """value_dtype: """
15016 return self._data.sm_util
15018 @sm_util.setter
15019 def sm_util(self, val):
15020 self._data.sm_util = val
15022 @property
15023 def mem_util(self):
15024 """value_dtype: """
15025 return self._data.mem_util
15027 @mem_util.setter
15028 def mem_util(self, val):
15029 self._data.mem_util = val
15031 @property
15032 def enc_util(self):
15033 """value_dtype: """
15034 return self._data.enc_util
15036 @enc_util.setter
15037 def enc_util(self, val):
15038 self._data.enc_util = val
15040 @property
15041 def dec_util(self):
15042 """value_dtype: """
15043 return self._data.dec_util
15045 @dec_util.setter
15046 def dec_util(self, val):
15047 self._data.dec_util = val
15049 def __getitem__(self, key):
15050 cdef ssize_t key_
15051 cdef ssize_t size
15052 if isinstance(key, int):
15053 key_ = key
15054 size = self._data.size
15055 if key_ >= size or key_ <= -(size+1):
15056 raise IndexError("index is out of bounds")
15057 if key_ < 0:
15058 key_ += size
15059 return VgpuInstanceUtilizationSample.from_data(self._data[key_:key_+1])
15060 out = self._data[key]
15061 if isinstance(out, _numpy.recarray) and out.dtype == vgpu_instance_utilization_sample_dtype:
15062 return VgpuInstanceUtilizationSample.from_data(out)
15063 return out
15065 def __setitem__(self, key, val):
15066 self._data[key] = val
15068 @staticmethod
15069 def from_data(data):
15070 """Create an VgpuInstanceUtilizationSample instance wrapping the given NumPy array.
15072 Args:
15073 data (_numpy.ndarray): a 1D array of dtype `vgpu_instance_utilization_sample_dtype` holding the data.
15074 """
15075 cdef VgpuInstanceUtilizationSample obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample)
15076 if not isinstance(data, _numpy.ndarray):
15077 raise TypeError("data argument must be a NumPy ndarray")
15078 if data.ndim != 1:
15079 raise ValueError("data array must be 1D")
15080 if data.dtype != vgpu_instance_utilization_sample_dtype:
15081 raise ValueError("data array must be of dtype vgpu_instance_utilization_sample_dtype")
15082 obj._data = data.view(_numpy.recarray)
15084 return obj
15086 @staticmethod
15087 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
15088 """Create an VgpuInstanceUtilizationSample instance wrapping the given pointer.
15090 Args:
15091 ptr (intptr_t): pointer address as Python :class:`int` to the data.
15092 size (int): number of structs, default=1.
15093 readonly (bool): whether the data is read-only (to the user). default is `False`.
15094 """
15095 if ptr == 0:
15096 raise ValueError("ptr must not be null (0)")
15097 cdef VgpuInstanceUtilizationSample obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample)
15098 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
15099 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
15100 <char*>ptr, sizeof(nvmlVgpuInstanceUtilizationSample_t) * size, flag)
15101 data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_sample_dtype)
15102 obj._data = data.view(_numpy.recarray)
15104 return obj
15107cdef _get_vgpu_instance_utilization_info_v1_dtype_offsets():
15108 cdef nvmlVgpuInstanceUtilizationInfo_v1_t pod = nvmlVgpuInstanceUtilizationInfo_v1_t()
15109 return _numpy.dtype({
15110 'names': ['time_stamp', 'vgpu_instance', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'],
15111 'formats': [_numpy.uint64, _numpy.uint32, value_dtype, value_dtype, value_dtype, value_dtype, value_dtype, value_dtype],
15112 'offsets': [
15113 (<intptr_t>&(pod.timeStamp)) - (<intptr_t>&pod),
15114 (<intptr_t>&(pod.vgpuInstance)) - (<intptr_t>&pod),
15115 (<intptr_t>&(pod.smUtil)) - (<intptr_t>&pod),
15116 (<intptr_t>&(pod.memUtil)) - (<intptr_t>&pod),
15117 (<intptr_t>&(pod.encUtil)) - (<intptr_t>&pod),
15118 (<intptr_t>&(pod.decUtil)) - (<intptr_t>&pod),
15119 (<intptr_t>&(pod.jpgUtil)) - (<intptr_t>&pod),
15120 (<intptr_t>&(pod.ofaUtil)) - (<intptr_t>&pod),
15121 ],
15122 'itemsize': sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t),
15123 })
15125vgpu_instance_utilization_info_v1_dtype = _get_vgpu_instance_utilization_info_v1_dtype_offsets()
15127cdef class VgpuInstanceUtilizationInfo_v1:
15128 """Empty-initialize an array of `nvmlVgpuInstanceUtilizationInfo_v1_t`.
15130 The resulting object is of length `size` and of dtype `vgpu_instance_utilization_info_v1_dtype`.
15131 If default-constructed, the instance represents a single struct.
15133 Args:
15134 size (int): number of structs, default=1.
15137 .. seealso:: `nvmlVgpuInstanceUtilizationInfo_v1_t`
15138 """
15139 cdef:
15140 readonly object _data
15144 def __init__(self, size=1):
15145 arr = _numpy.empty(size, dtype=vgpu_instance_utilization_info_v1_dtype)
15146 self._data = arr.view(_numpy.recarray)
15147 assert self._data.itemsize == sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t), \
15148 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t) }"
15150 def __repr__(self):
15151 if self._data.size > 1:
15152 return f"<{__name__}.VgpuInstanceUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>"
15153 else:
15154 return f"<{__name__}.VgpuInstanceUtilizationInfo_v1 object at {hex(id(self))}>"
15156 @property
15157 def ptr(self):
15158 """Get the pointer address to the data as Python :class:`int`."""
15159 return self._data.ctypes.data
15161 cdef intptr_t _get_ptr(self):
15162 return self._data.ctypes.data
15164 def __int__(self):
15165 if self._data.size > 1:
15166 raise TypeError("int() argument must be a bytes-like object of size 1. "
15167 "To get the pointer address of an array, use .ptr")
15168 return self._data.ctypes.data
15170 def __len__(self):
15171 return self._data.size
15173 def __eq__(self, other):
15174 cdef object self_data = self._data
15175 if (not isinstance(other, VgpuInstanceUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
15176 return False
15177 return bool((self_data == other._data).all())
15179 @property
15180 def time_stamp(self):
15181 """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds."""
15182 if self._data.size == 1:
15183 return int(self._data.time_stamp[0])
15184 return self._data.time_stamp
15186 @time_stamp.setter
15187 def time_stamp(self, val):
15188 self._data.time_stamp = val
15190 @property
15191 def vgpu_instance(self):
15192 """Union[~_numpy.uint32, int]: vGPU Instance"""
15193 if self._data.size == 1:
15194 return int(self._data.vgpu_instance[0])
15195 return self._data.vgpu_instance
15197 @vgpu_instance.setter
15198 def vgpu_instance(self, val):
15199 self._data.vgpu_instance = val
15201 @property
15202 def sm_util(self):
15203 """value_dtype: SM (3D/Compute) Util Value."""
15204 return self._data.sm_util
15206 @sm_util.setter
15207 def sm_util(self, val):
15208 self._data.sm_util = val
15210 @property
15211 def mem_util(self):
15212 """value_dtype: Frame Buffer Memory Util Value."""
15213 return self._data.mem_util
15215 @mem_util.setter
15216 def mem_util(self, val):
15217 self._data.mem_util = val
15219 @property
15220 def enc_util(self):
15221 """value_dtype: Encoder Util Value."""
15222 return self._data.enc_util
15224 @enc_util.setter
15225 def enc_util(self, val):
15226 self._data.enc_util = val
15228 @property
15229 def dec_util(self):
15230 """value_dtype: Decoder Util Value."""
15231 return self._data.dec_util
15233 @dec_util.setter
15234 def dec_util(self, val):
15235 self._data.dec_util = val
15237 @property
15238 def jpg_util(self):
15239 """value_dtype: Jpeg Util Value."""
15240 return self._data.jpg_util
15242 @jpg_util.setter
15243 def jpg_util(self, val):
15244 self._data.jpg_util = val
15246 @property
15247 def ofa_util(self):
15248 """value_dtype: Ofa Util Value."""
15249 return self._data.ofa_util
15251 @ofa_util.setter
15252 def ofa_util(self, val):
15253 self._data.ofa_util = val
15255 def __getitem__(self, key):
15256 cdef ssize_t key_
15257 cdef ssize_t size
15258 if isinstance(key, int):
15259 key_ = key
15260 size = self._data.size
15261 if key_ >= size or key_ <= -(size+1):
15262 raise IndexError("index is out of bounds")
15263 if key_ < 0:
15264 key_ += size
15265 return VgpuInstanceUtilizationInfo_v1.from_data(self._data[key_:key_+1])
15266 out = self._data[key]
15267 if isinstance(out, _numpy.recarray) and out.dtype == vgpu_instance_utilization_info_v1_dtype:
15268 return VgpuInstanceUtilizationInfo_v1.from_data(out)
15269 return out
15271 def __setitem__(self, key, val):
15272 self._data[key] = val
15274 @staticmethod
15275 def from_data(data):
15276 """Create an VgpuInstanceUtilizationInfo_v1 instance wrapping the given NumPy array.
15278 Args:
15279 data (_numpy.ndarray): a 1D array of dtype `vgpu_instance_utilization_info_v1_dtype` holding the data.
15280 """
15281 cdef VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_v1)
15282 if not isinstance(data, _numpy.ndarray):
15283 raise TypeError("data argument must be a NumPy ndarray")
15284 if data.ndim != 1:
15285 raise ValueError("data array must be 1D")
15286 if data.dtype != vgpu_instance_utilization_info_v1_dtype:
15287 raise ValueError("data array must be of dtype vgpu_instance_utilization_info_v1_dtype")
15288 obj._data = data.view(_numpy.recarray)
15290 return obj
15292 @staticmethod
15293 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
15294 """Create an VgpuInstanceUtilizationInfo_v1 instance wrapping the given pointer.
15296 Args:
15297 ptr (intptr_t): pointer address as Python :class:`int` to the data.
15298 size (int): number of structs, default=1.
15299 readonly (bool): whether the data is read-only (to the user). default is `False`.
15300 """
15301 if ptr == 0:
15302 raise ValueError("ptr must not be null (0)")
15303 cdef VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_v1)
15304 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
15305 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
15306 <char*>ptr, sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t) * size, flag)
15307 data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_info_v1_dtype)
15308 obj._data = data.view(_numpy.recarray)
15310 return obj
15313cdef _get_field_value_dtype_offsets():
15314 cdef nvmlFieldValue_t pod = nvmlFieldValue_t()
15315 return _numpy.dtype({
15316 'names': ['field_id', 'scope_id', 'timestamp', 'latency_usec', 'value_type', 'nvml_return', 'value'],
15317 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int64, _numpy.int64, _numpy.int32, _numpy.int32, value_dtype],
15318 'offsets': [
15319 (<intptr_t>&(pod.fieldId)) - (<intptr_t>&pod),
15320 (<intptr_t>&(pod.scopeId)) - (<intptr_t>&pod),
15321 (<intptr_t>&(pod.timestamp)) - (<intptr_t>&pod),
15322 (<intptr_t>&(pod.latencyUsec)) - (<intptr_t>&pod),
15323 (<intptr_t>&(pod.valueType)) - (<intptr_t>&pod),
15324 (<intptr_t>&(pod.nvmlReturn)) - (<intptr_t>&pod),
15325 (<intptr_t>&(pod.value)) - (<intptr_t>&pod),
15326 ],
15327 'itemsize': sizeof(nvmlFieldValue_t),
15328 })
15330field_value_dtype = _get_field_value_dtype_offsets()
15332cdef class FieldValue:
15333 """Empty-initialize an array of `nvmlFieldValue_t`.
15335 The resulting object is of length `size` and of dtype `field_value_dtype`.
15336 If default-constructed, the instance represents a single struct.
15338 Args:
15339 size (int): number of structs, default=1.
15342 .. seealso:: `nvmlFieldValue_t`
15343 """
15344 cdef:
15345 readonly object _data
15349 def __init__(self, size=1):
15350 arr = _numpy.empty(size, dtype=field_value_dtype) 1od
15351 self._data = arr.view(_numpy.recarray) 1od
15352 assert self._data.itemsize == sizeof(nvmlFieldValue_t), \ 1od
15353 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlFieldValue_t) }"
15355 def __repr__(self):
15356 if self._data.size > 1:
15357 return f"<{__name__}.FieldValue_Array_{self._data.size} object at {hex(id(self))}>"
15358 else:
15359 return f"<{__name__}.FieldValue object at {hex(id(self))}>"
15361 @property
15362 def ptr(self):
15363 """Get the pointer address to the data as Python :class:`int`."""
15364 return self._data.ctypes.data
15366 cdef intptr_t _get_ptr(self):
15367 return self._data.ctypes.data 1od
15369 def __int__(self):
15370 if self._data.size > 1:
15371 raise TypeError("int() argument must be a bytes-like object of size 1. "
15372 "To get the pointer address of an array, use .ptr")
15373 return self._data.ctypes.data
15375 def __len__(self):
15376 return self._data.size 1od
15378 def __eq__(self, other):
15379 cdef object self_data = self._data
15380 if (not isinstance(other, FieldValue)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
15381 return False
15382 return bool((self_data == other._data).all())
15384 @property
15385 def field_id(self):
15386 """Union[~_numpy.uint32, int]: """
15387 if self._data.size == 1: 1d
15388 return int(self._data.field_id[0]) 1d
15389 return self._data.field_id
15391 @field_id.setter
15392 def field_id(self, val):
15393 self._data.field_id = val 1od
15395 @property
15396 def scope_id(self):
15397 """Union[~_numpy.uint32, int]: """
15398 if self._data.size == 1:
15399 return int(self._data.scope_id[0])
15400 return self._data.scope_id
15402 @scope_id.setter
15403 def scope_id(self, val):
15404 self._data.scope_id = val
15406 @property
15407 def timestamp(self):
15408 """Union[~_numpy.int64, int]: """
15409 if self._data.size == 1: 1d
15410 return int(self._data.timestamp[0]) 1d
15411 return self._data.timestamp
15413 @timestamp.setter
15414 def timestamp(self, val):
15415 self._data.timestamp = val
15417 @property
15418 def latency_usec(self):
15419 """Union[~_numpy.int64, int]: """
15420 if self._data.size == 1: 1d
15421 return int(self._data.latency_usec[0]) 1d
15422 return self._data.latency_usec
15424 @latency_usec.setter
15425 def latency_usec(self, val):
15426 self._data.latency_usec = val
15428 @property
15429 def value_type(self):
15430 """Union[~_numpy.int32, int]: """
15431 if self._data.size == 1: 1d
15432 return int(self._data.value_type[0]) 1d
15433 return self._data.value_type
15435 @value_type.setter
15436 def value_type(self, val):
15437 self._data.value_type = val
15439 @property
15440 def nvml_return(self):
15441 """Union[~_numpy.int32, int]: """
15442 if self._data.size == 1: 1od
15443 return int(self._data.nvml_return[0]) 1od
15444 return self._data.nvml_return 1d
15446 @nvml_return.setter
15447 def nvml_return(self, val):
15448 self._data.nvml_return = val
15450 @property
15451 def value(self):
15452 """value_dtype: """
15453 return self._data.value 1d
15455 @value.setter
15456 def value(self, val):
15457 self._data.value = val
15459 def __getitem__(self, key):
15460 cdef ssize_t key_
15461 cdef ssize_t size
15462 if isinstance(key, int): 1od
15463 key_ = key 1od
15464 size = self._data.size 1od
15465 if key_ >= size or key_ <= -(size+1): 1od
15466 raise IndexError("index is out of bounds") 1d
15467 if key_ < 0: 1od
15468 key_ += size
15469 return FieldValue.from_data(self._data[key_:key_+1]) 1od
15470 out = self._data[key]
15471 if isinstance(out, _numpy.recarray) and out.dtype == field_value_dtype:
15472 return FieldValue.from_data(out)
15473 return out
15475 def __setitem__(self, key, val):
15476 self._data[key] = val
15478 @staticmethod
15479 def from_data(data):
15480 """Create an FieldValue instance wrapping the given NumPy array.
15482 Args:
15483 data (_numpy.ndarray): a 1D array of dtype `field_value_dtype` holding the data.
15484 """
15485 cdef FieldValue obj = FieldValue.__new__(FieldValue) 1od
15486 if not isinstance(data, _numpy.ndarray): 1od
15487 raise TypeError("data argument must be a NumPy ndarray")
15488 if data.ndim != 1: 1od
15489 raise ValueError("data array must be 1D")
15490 if data.dtype != field_value_dtype: 1od
15491 raise ValueError("data array must be of dtype field_value_dtype")
15492 obj._data = data.view(_numpy.recarray) 1od
15494 return obj 1od
15496 @staticmethod
15497 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
15498 """Create an FieldValue instance wrapping the given pointer.
15500 Args:
15501 ptr (intptr_t): pointer address as Python :class:`int` to the data.
15502 size (int): number of structs, default=1.
15503 readonly (bool): whether the data is read-only (to the user). default is `False`.
15504 """
15505 if ptr == 0:
15506 raise ValueError("ptr must not be null (0)")
15507 cdef FieldValue obj = FieldValue.__new__(FieldValue)
15508 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
15509 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
15510 <char*>ptr, sizeof(nvmlFieldValue_t) * size, flag)
15511 data = _numpy.ndarray(size, buffer=buf, dtype=field_value_dtype)
15512 obj._data = data.view(_numpy.recarray)
15514 return obj
15517cdef _get_prm_counter_value_v1_dtype_offsets():
15518 cdef nvmlPRMCounterValue_v1_t pod = nvmlPRMCounterValue_v1_t()
15519 return _numpy.dtype({
15520 'names': ['status', 'output_type', 'output_value'],
15521 'formats': [_numpy.int32, _numpy.int32, value_dtype],
15522 'offsets': [
15523 (<intptr_t>&(pod.status)) - (<intptr_t>&pod),
15524 (<intptr_t>&(pod.outputType)) - (<intptr_t>&pod),
15525 (<intptr_t>&(pod.outputValue)) - (<intptr_t>&pod),
15526 ],
15527 'itemsize': sizeof(nvmlPRMCounterValue_v1_t),
15528 })
15530prm_counter_value_v1_dtype = _get_prm_counter_value_v1_dtype_offsets()
15532cdef class PRMCounterValue_v1:
15533 """Empty-initialize an instance of `nvmlPRMCounterValue_v1_t`.
15536 .. seealso:: `nvmlPRMCounterValue_v1_t`
15537 """
15538 cdef:
15539 nvmlPRMCounterValue_v1_t *_ptr
15540 object _owner
15541 bint _owned
15542 bint _readonly
15544 def __init__(self):
15545 self._ptr = <nvmlPRMCounterValue_v1_t *>calloc(1, sizeof(nvmlPRMCounterValue_v1_t))
15546 if self._ptr == NULL:
15547 raise MemoryError("Error allocating PRMCounterValue_v1")
15548 self._owner = None
15549 self._owned = True
15550 self._readonly = False
15552 def __dealloc__(self):
15553 cdef nvmlPRMCounterValue_v1_t *ptr
15554 if self._owned and self._ptr != NULL:
15555 ptr = self._ptr
15556 self._ptr = NULL
15557 free(ptr)
15559 def __repr__(self):
15560 return f"<{__name__}.PRMCounterValue_v1 object at {hex(id(self))}>"
15562 @property
15563 def ptr(self):
15564 """Get the pointer address to the data as Python :class:`int`."""
15565 return <intptr_t>(self._ptr)
15567 cdef intptr_t _get_ptr(self):
15568 return <intptr_t>(self._ptr)
15570 def __int__(self):
15571 return <intptr_t>(self._ptr)
15573 def __eq__(self, other):
15574 cdef PRMCounterValue_v1 other_
15575 if not isinstance(other, PRMCounterValue_v1):
15576 return False
15577 other_ = other
15578 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlPRMCounterValue_v1_t)) == 0)
15580 def __setitem__(self, key, val):
15581 if key == 0 and isinstance(val, _numpy.ndarray):
15582 self._ptr = <nvmlPRMCounterValue_v1_t *>malloc(sizeof(nvmlPRMCounterValue_v1_t))
15583 if self._ptr == NULL:
15584 raise MemoryError("Error allocating PRMCounterValue_v1")
15585 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlPRMCounterValue_v1_t))
15586 self._owner = None
15587 self._owned = True
15588 self._readonly = not val.flags.writeable
15589 else:
15590 setattr(self, key, val)
15592 @property
15593 def output_value(self):
15594 """Value: Output value."""
15595 return Value.from_ptr(<intptr_t>&(self._ptr[0].outputValue), self._readonly, self)
15597 @output_value.setter
15598 def output_value(self, val):
15599 if self._readonly:
15600 raise ValueError("This PRMCounterValue_v1 instance is read-only")
15601 cdef Value val_ = val
15602 memcpy(<void *>&(self._ptr[0].outputValue), <void *>(val_._get_ptr()), sizeof(nvmlValue_t) * 1)
15604 @property
15605 def status(self):
15606 """int: Status of the PRM counter read."""
15607 return <int>(self._ptr[0].status)
15609 @status.setter
15610 def status(self, val):
15611 if self._readonly:
15612 raise ValueError("This PRMCounterValue_v1 instance is read-only")
15613 self._ptr[0].status = <nvmlReturn_t><int>val
15615 @property
15616 def output_type(self):
15617 """int: Output value type."""
15618 return <int>(self._ptr[0].outputType)
15620 @output_type.setter
15621 def output_type(self, val):
15622 if self._readonly:
15623 raise ValueError("This PRMCounterValue_v1 instance is read-only")
15624 self._ptr[0].outputType = <nvmlValueType_t><int>val
15626 @staticmethod
15627 def from_data(data):
15628 """Create an PRMCounterValue_v1 instance wrapping the given NumPy array.
15630 Args:
15631 data (_numpy.ndarray): a single-element array of dtype `prm_counter_value_v1_dtype` holding the data.
15632 """
15633 return __from_data(data, "prm_counter_value_v1_dtype", prm_counter_value_v1_dtype, PRMCounterValue_v1)
15635 @staticmethod
15636 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
15637 """Create an PRMCounterValue_v1 instance wrapping the given pointer.
15639 Args:
15640 ptr (intptr_t): pointer address as Python :class:`int` to the data.
15641 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
15642 readonly (bool): whether the data is read-only (to the user). default is `False`.
15643 """
15644 if ptr == 0:
15645 raise ValueError("ptr must not be null (0)")
15646 cdef PRMCounterValue_v1 obj = PRMCounterValue_v1.__new__(PRMCounterValue_v1)
15647 if owner is None:
15648 obj._ptr = <nvmlPRMCounterValue_v1_t *>malloc(sizeof(nvmlPRMCounterValue_v1_t))
15649 if obj._ptr == NULL:
15650 raise MemoryError("Error allocating PRMCounterValue_v1")
15651 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlPRMCounterValue_v1_t))
15652 obj._owner = None
15653 obj._owned = True
15654 else:
15655 obj._ptr = <nvmlPRMCounterValue_v1_t *>ptr
15656 obj._owner = owner
15657 obj._owned = False
15658 obj._readonly = readonly
15659 return obj
15662cdef _get_gpu_thermal_settings_dtype_offsets():
15663 cdef nvmlGpuThermalSettings_t pod = nvmlGpuThermalSettings_t()
15664 return _numpy.dtype({
15665 'names': ['count', 'sensor'],
15666 'formats': [_numpy.uint32, (_py_anon_pod0_dtype, 3)],
15667 'offsets': [
15668 (<intptr_t>&(pod.count)) - (<intptr_t>&pod),
15669 (<intptr_t>&(pod.sensor)) - (<intptr_t>&pod),
15670 ],
15671 'itemsize': sizeof(nvmlGpuThermalSettings_t),
15672 })
15674gpu_thermal_settings_dtype = _get_gpu_thermal_settings_dtype_offsets()
15676cdef class GpuThermalSettings:
15677 """Empty-initialize an instance of `nvmlGpuThermalSettings_t`.
15680 .. seealso:: `nvmlGpuThermalSettings_t`
15681 """
15682 cdef:
15683 nvmlGpuThermalSettings_t *_ptr
15684 object _owner
15685 bint _owned
15686 bint _readonly
15688 def __init__(self):
15689 self._ptr = <nvmlGpuThermalSettings_t *>calloc(1, sizeof(nvmlGpuThermalSettings_t))
15690 if self._ptr == NULL:
15691 raise MemoryError("Error allocating GpuThermalSettings")
15692 self._owner = None
15693 self._owned = True
15694 self._readonly = False
15696 def __dealloc__(self):
15697 cdef nvmlGpuThermalSettings_t *ptr
15698 if self._owned and self._ptr != NULL:
15699 ptr = self._ptr
15700 self._ptr = NULL
15701 free(ptr)
15703 def __repr__(self):
15704 return f"<{__name__}.GpuThermalSettings object at {hex(id(self))}>"
15706 @property
15707 def ptr(self):
15708 """Get the pointer address to the data as Python :class:`int`."""
15709 return <intptr_t>(self._ptr)
15711 cdef intptr_t _get_ptr(self):
15712 return <intptr_t>(self._ptr)
15714 def __int__(self):
15715 return <intptr_t>(self._ptr)
15717 def __eq__(self, other):
15718 cdef GpuThermalSettings other_
15719 if not isinstance(other, GpuThermalSettings):
15720 return False
15721 other_ = other
15722 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGpuThermalSettings_t)) == 0)
15724 def __setitem__(self, key, val):
15725 if key == 0 and isinstance(val, _numpy.ndarray):
15726 self._ptr = <nvmlGpuThermalSettings_t *>malloc(sizeof(nvmlGpuThermalSettings_t))
15727 if self._ptr == NULL:
15728 raise MemoryError("Error allocating GpuThermalSettings")
15729 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGpuThermalSettings_t))
15730 self._owner = None
15731 self._owned = True
15732 self._readonly = not val.flags.writeable
15733 else:
15734 setattr(self, key, val)
15736 @property
15737 def sensor(self):
15738 """_py_anon_pod0: """
15739 return _py_anon_pod0.from_ptr(<intptr_t>&(self._ptr[0].sensor), 3, self._readonly)
15741 @sensor.setter
15742 def sensor(self, val):
15743 if self._readonly:
15744 raise ValueError("This GpuThermalSettings instance is read-only")
15745 cdef _py_anon_pod0 val_ = val
15746 if len(val) != 3:
15747 raise ValueError(f"Expected length { 3 } for field sensor, got {len(val)}")
15748 memcpy(<void *>&(self._ptr[0].sensor), <void *>(val_._get_ptr()), sizeof(_anon_pod0) * 3)
15750 @property
15751 def count(self):
15752 """int: """
15753 return self._ptr[0].count
15755 @count.setter
15756 def count(self, val):
15757 if self._readonly:
15758 raise ValueError("This GpuThermalSettings instance is read-only")
15759 self._ptr[0].count = val
15761 @staticmethod
15762 def from_data(data):
15763 """Create an GpuThermalSettings instance wrapping the given NumPy array.
15765 Args:
15766 data (_numpy.ndarray): a single-element array of dtype `gpu_thermal_settings_dtype` holding the data.
15767 """
15768 return __from_data(data, "gpu_thermal_settings_dtype", gpu_thermal_settings_dtype, GpuThermalSettings)
15770 @staticmethod
15771 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
15772 """Create an GpuThermalSettings instance wrapping the given pointer.
15774 Args:
15775 ptr (intptr_t): pointer address as Python :class:`int` to the data.
15776 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
15777 readonly (bool): whether the data is read-only (to the user). default is `False`.
15778 """
15779 if ptr == 0:
15780 raise ValueError("ptr must not be null (0)")
15781 cdef GpuThermalSettings obj = GpuThermalSettings.__new__(GpuThermalSettings)
15782 if owner is None:
15783 obj._ptr = <nvmlGpuThermalSettings_t *>malloc(sizeof(nvmlGpuThermalSettings_t))
15784 if obj._ptr == NULL:
15785 raise MemoryError("Error allocating GpuThermalSettings")
15786 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGpuThermalSettings_t))
15787 obj._owner = None
15788 obj._owned = True
15789 else:
15790 obj._ptr = <nvmlGpuThermalSettings_t *>ptr
15791 obj._owner = owner
15792 obj._owned = False
15793 obj._readonly = readonly
15794 return obj
15797cdef _get_clk_mon_status_dtype_offsets():
15798 cdef nvmlClkMonStatus_t pod = nvmlClkMonStatus_t()
15799 return _numpy.dtype({
15800 'names': ['b_global_status', 'clk_mon_list_size', 'clk_mon_list'],
15801 'formats': [_numpy.uint32, _numpy.uint32, (clk_mon_fault_info_dtype, 32)],
15802 'offsets': [
15803 (<intptr_t>&(pod.bGlobalStatus)) - (<intptr_t>&pod),
15804 (<intptr_t>&(pod.clkMonListSize)) - (<intptr_t>&pod),
15805 (<intptr_t>&(pod.clkMonList)) - (<intptr_t>&pod),
15806 ],
15807 'itemsize': sizeof(nvmlClkMonStatus_t),
15808 })
15810clk_mon_status_dtype = _get_clk_mon_status_dtype_offsets()
15812cdef class ClkMonStatus:
15813 """Empty-initialize an instance of `nvmlClkMonStatus_t`.
15816 .. seealso:: `nvmlClkMonStatus_t`
15817 """
15818 cdef:
15819 nvmlClkMonStatus_t *_ptr
15820 object _owner
15821 bint _owned
15822 bint _readonly
15824 def __init__(self):
15825 self._ptr = <nvmlClkMonStatus_t *>calloc(1, sizeof(nvmlClkMonStatus_t)) 13
15826 if self._ptr == NULL: 13
15827 raise MemoryError("Error allocating ClkMonStatus")
15828 self._owner = None 13
15829 self._owned = True 13
15830 self._readonly = False 13
15832 def __dealloc__(self):
15833 cdef nvmlClkMonStatus_t *ptr
15834 if self._owned and self._ptr != NULL: 13
15835 ptr = self._ptr 13
15836 self._ptr = NULL 13
15837 free(ptr) 13
15839 def __repr__(self):
15840 return f"<{__name__}.ClkMonStatus object at {hex(id(self))}>"
15842 @property
15843 def ptr(self):
15844 """Get the pointer address to the data as Python :class:`int`."""
15845 return <intptr_t>(self._ptr)
15847 cdef intptr_t _get_ptr(self):
15848 return <intptr_t>(self._ptr)
15850 def __int__(self):
15851 return <intptr_t>(self._ptr)
15853 def __eq__(self, other):
15854 cdef ClkMonStatus other_
15855 if not isinstance(other, ClkMonStatus):
15856 return False
15857 other_ = other
15858 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlClkMonStatus_t)) == 0)
15860 def __setitem__(self, key, val):
15861 if key == 0 and isinstance(val, _numpy.ndarray):
15862 self._ptr = <nvmlClkMonStatus_t *>malloc(sizeof(nvmlClkMonStatus_t))
15863 if self._ptr == NULL:
15864 raise MemoryError("Error allocating ClkMonStatus")
15865 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlClkMonStatus_t))
15866 self._owner = None
15867 self._owned = True
15868 self._readonly = not val.flags.writeable
15869 else:
15870 setattr(self, key, val)
15872 @property
15873 def clk_mon_list(self):
15874 """ClkMonFaultInfo: """
15875 return ClkMonFaultInfo.from_ptr(<intptr_t>&(self._ptr[0].clkMonList), self._ptr[0].clkMonListSize, self._readonly) 13
15877 @clk_mon_list.setter
15878 def clk_mon_list(self, val):
15879 if self._readonly:
15880 raise ValueError("This ClkMonStatus instance is read-only")
15881 cdef ClkMonFaultInfo val_ = val
15882 if len(val) > 32:
15883 raise ValueError(f"Expected length < 32 for field clk_mon_list, got {len(val)}")
15884 self._ptr[0].clkMonListSize = len(val)
15885 if len(val) == 0:
15886 return
15887 memcpy(<void *>&(self._ptr[0].clkMonList), <void *>(val_._get_ptr()), sizeof(nvmlClkMonFaultInfo_t) * self._ptr[0].clkMonListSize)
15889 @property
15890 def b_global_status(self):
15891 """int: """
15892 return self._ptr[0].bGlobalStatus
15894 @b_global_status.setter
15895 def b_global_status(self, val):
15896 if self._readonly:
15897 raise ValueError("This ClkMonStatus instance is read-only")
15898 self._ptr[0].bGlobalStatus = val
15900 @staticmethod
15901 def from_data(data):
15902 """Create an ClkMonStatus instance wrapping the given NumPy array.
15904 Args:
15905 data (_numpy.ndarray): a single-element array of dtype `clk_mon_status_dtype` holding the data.
15906 """
15907 return __from_data(data, "clk_mon_status_dtype", clk_mon_status_dtype, ClkMonStatus)
15909 @staticmethod
15910 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
15911 """Create an ClkMonStatus instance wrapping the given pointer.
15913 Args:
15914 ptr (intptr_t): pointer address as Python :class:`int` to the data.
15915 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
15916 readonly (bool): whether the data is read-only (to the user). default is `False`.
15917 """
15918 if ptr == 0:
15919 raise ValueError("ptr must not be null (0)")
15920 cdef ClkMonStatus obj = ClkMonStatus.__new__(ClkMonStatus)
15921 if owner is None:
15922 obj._ptr = <nvmlClkMonStatus_t *>malloc(sizeof(nvmlClkMonStatus_t))
15923 if obj._ptr == NULL:
15924 raise MemoryError("Error allocating ClkMonStatus")
15925 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlClkMonStatus_t))
15926 obj._owner = None
15927 obj._owned = True
15928 else:
15929 obj._ptr = <nvmlClkMonStatus_t *>ptr
15930 obj._owner = owner
15931 obj._owned = False
15932 obj._readonly = readonly
15933 return obj
15936cdef _get_processes_utilization_info_v1_dtype_offsets():
15937 cdef nvmlProcessesUtilizationInfo_v1_t pod = nvmlProcessesUtilizationInfo_v1_t()
15938 return _numpy.dtype({
15939 'names': ['version', 'process_samples_count', 'last_seen_time_stamp', 'proc_util_array'],
15940 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.intp],
15941 'offsets': [
15942 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
15943 (<intptr_t>&(pod.processSamplesCount)) - (<intptr_t>&pod),
15944 (<intptr_t>&(pod.lastSeenTimeStamp)) - (<intptr_t>&pod),
15945 (<intptr_t>&(pod.procUtilArray)) - (<intptr_t>&pod),
15946 ],
15947 'itemsize': sizeof(nvmlProcessesUtilizationInfo_v1_t),
15948 })
15950processes_utilization_info_v1_dtype = _get_processes_utilization_info_v1_dtype_offsets()
15952cdef class ProcessesUtilizationInfo_v1:
15953 """Empty-initialize an instance of `nvmlProcessesUtilizationInfo_v1_t`.
15956 .. seealso:: `nvmlProcessesUtilizationInfo_v1_t`
15957 """
15958 cdef:
15959 nvmlProcessesUtilizationInfo_v1_t *_ptr
15960 object _owner
15961 bint _owned
15962 bint _readonly
15963 dict _refs
15965 def __init__(self):
15966 self._ptr = <nvmlProcessesUtilizationInfo_v1_t *>calloc(1, sizeof(nvmlProcessesUtilizationInfo_v1_t))
15967 if self._ptr == NULL:
15968 raise MemoryError("Error allocating ProcessesUtilizationInfo_v1")
15969 self._owner = None
15970 self._owned = True
15971 self._readonly = False
15972 self._refs = {}
15974 def __dealloc__(self):
15975 cdef nvmlProcessesUtilizationInfo_v1_t *ptr
15976 if self._owned and self._ptr != NULL:
15977 ptr = self._ptr
15978 self._ptr = NULL
15979 free(ptr)
15981 def __repr__(self):
15982 return f"<{__name__}.ProcessesUtilizationInfo_v1 object at {hex(id(self))}>"
15984 @property
15985 def ptr(self):
15986 """Get the pointer address to the data as Python :class:`int`."""
15987 return <intptr_t>(self._ptr)
15989 cdef intptr_t _get_ptr(self):
15990 return <intptr_t>(self._ptr)
15992 def __int__(self):
15993 return <intptr_t>(self._ptr)
15995 def __eq__(self, other):
15996 cdef ProcessesUtilizationInfo_v1 other_
15997 if not isinstance(other, ProcessesUtilizationInfo_v1):
15998 return False
15999 other_ = other
16000 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlProcessesUtilizationInfo_v1_t)) == 0)
16002 def __setitem__(self, key, val):
16003 if key == 0 and isinstance(val, _numpy.ndarray):
16004 self._ptr = <nvmlProcessesUtilizationInfo_v1_t *>malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t))
16005 if self._ptr == NULL:
16006 raise MemoryError("Error allocating ProcessesUtilizationInfo_v1")
16007 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlProcessesUtilizationInfo_v1_t))
16008 self._owner = None
16009 self._owned = True
16010 self._readonly = not val.flags.writeable
16011 else:
16012 setattr(self, key, val)
16014 @property
16015 def version(self):
16016 """int: The version number of this struct."""
16017 return self._ptr[0].version
16019 @version.setter
16020 def version(self, val):
16021 if self._readonly:
16022 raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only")
16023 self._ptr[0].version = val
16025 @property
16026 def last_seen_time_stamp(self):
16027 """int: Return only samples with timestamp greater than lastSeenTimeStamp."""
16028 return self._ptr[0].lastSeenTimeStamp
16030 @last_seen_time_stamp.setter
16031 def last_seen_time_stamp(self, val):
16032 if self._readonly:
16033 raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only")
16034 self._ptr[0].lastSeenTimeStamp = val
16036 @property
16037 def proc_util_array(self):
16038 """int: The array (allocated by caller) of the utilization of GPU SM, framebuffer, video encoder, video decoder, JPEG, and OFA."""
16039 if self._ptr[0].procUtilArray == NULL or self._ptr[0].processSamplesCount == 0:
16040 return []
16041 return ProcessUtilizationInfo_v1.from_ptr(<intptr_t>(self._ptr[0].procUtilArray), self._ptr[0].processSamplesCount)
16043 @proc_util_array.setter
16044 def proc_util_array(self, val):
16045 if self._readonly:
16046 raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only")
16047 cdef ProcessUtilizationInfo_v1 arr = val
16048 self._ptr[0].procUtilArray = <nvmlProcessUtilizationInfo_v1_t*><intptr_t>(arr._get_ptr())
16049 self._ptr[0].processSamplesCount = len(arr)
16050 self._refs["proc_util_array"] = arr
16052 @staticmethod
16053 def from_data(data):
16054 """Create an ProcessesUtilizationInfo_v1 instance wrapping the given NumPy array.
16056 Args:
16057 data (_numpy.ndarray): a single-element array of dtype `processes_utilization_info_v1_dtype` holding the data.
16058 """
16059 return __from_data(data, "processes_utilization_info_v1_dtype", processes_utilization_info_v1_dtype, ProcessesUtilizationInfo_v1)
16061 @staticmethod
16062 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
16063 """Create an ProcessesUtilizationInfo_v1 instance wrapping the given pointer.
16065 Args:
16066 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16067 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
16068 readonly (bool): whether the data is read-only (to the user). default is `False`.
16069 """
16070 if ptr == 0:
16071 raise ValueError("ptr must not be null (0)")
16072 cdef ProcessesUtilizationInfo_v1 obj = ProcessesUtilizationInfo_v1.__new__(ProcessesUtilizationInfo_v1)
16073 if owner is None:
16074 obj._ptr = <nvmlProcessesUtilizationInfo_v1_t *>malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t))
16075 if obj._ptr == NULL:
16076 raise MemoryError("Error allocating ProcessesUtilizationInfo_v1")
16077 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t))
16078 obj._owner = None
16079 obj._owned = True
16080 else:
16081 obj._ptr = <nvmlProcessesUtilizationInfo_v1_t *>ptr
16082 obj._owner = owner
16083 obj._owned = False
16084 obj._readonly = readonly
16085 obj._refs = {}
16086 return obj
16089cdef _get_gpu_dynamic_pstates_info_dtype_offsets():
16090 cdef nvmlGpuDynamicPstatesInfo_t pod = nvmlGpuDynamicPstatesInfo_t()
16091 return _numpy.dtype({
16092 'names': ['flags_', 'utilization'],
16093 'formats': [_numpy.uint32, (_py_anon_pod1_dtype, 8)],
16094 'offsets': [
16095 (<intptr_t>&(pod.flags)) - (<intptr_t>&pod),
16096 (<intptr_t>&(pod.utilization)) - (<intptr_t>&pod),
16097 ],
16098 'itemsize': sizeof(nvmlGpuDynamicPstatesInfo_t),
16099 })
16101gpu_dynamic_pstates_info_dtype = _get_gpu_dynamic_pstates_info_dtype_offsets()
16103cdef class GpuDynamicPstatesInfo:
16104 """Empty-initialize an instance of `nvmlGpuDynamicPstatesInfo_t`.
16107 .. seealso:: `nvmlGpuDynamicPstatesInfo_t`
16108 """
16109 cdef:
16110 nvmlGpuDynamicPstatesInfo_t *_ptr
16111 object _owner
16112 bint _owned
16113 bint _readonly
16115 def __init__(self):
16116 self._ptr = <nvmlGpuDynamicPstatesInfo_t *>calloc(1, sizeof(nvmlGpuDynamicPstatesInfo_t)) 1f
16117 if self._ptr == NULL: 1f
16118 raise MemoryError("Error allocating GpuDynamicPstatesInfo")
16119 self._owner = None 1f
16120 self._owned = True 1f
16121 self._readonly = False 1f
16123 def __dealloc__(self):
16124 cdef nvmlGpuDynamicPstatesInfo_t *ptr
16125 if self._owned and self._ptr != NULL: 1f
16126 ptr = self._ptr 1f
16127 self._ptr = NULL 1f
16128 free(ptr) 1f
16130 def __repr__(self):
16131 return f"<{__name__}.GpuDynamicPstatesInfo object at {hex(id(self))}>"
16133 @property
16134 def ptr(self):
16135 """Get the pointer address to the data as Python :class:`int`."""
16136 return <intptr_t>(self._ptr)
16138 cdef intptr_t _get_ptr(self):
16139 return <intptr_t>(self._ptr) 1f
16141 def __int__(self):
16142 return <intptr_t>(self._ptr)
16144 def __eq__(self, other):
16145 cdef GpuDynamicPstatesInfo other_
16146 if not isinstance(other, GpuDynamicPstatesInfo):
16147 return False
16148 other_ = other
16149 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGpuDynamicPstatesInfo_t)) == 0)
16151 def __setitem__(self, key, val):
16152 if key == 0 and isinstance(val, _numpy.ndarray):
16153 self._ptr = <nvmlGpuDynamicPstatesInfo_t *>malloc(sizeof(nvmlGpuDynamicPstatesInfo_t))
16154 if self._ptr == NULL:
16155 raise MemoryError("Error allocating GpuDynamicPstatesInfo")
16156 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGpuDynamicPstatesInfo_t))
16157 self._owner = None
16158 self._owned = True
16159 self._readonly = not val.flags.writeable
16160 else:
16161 setattr(self, key, val)
16163 @property
16164 def utilization(self):
16165 """_py_anon_pod1: """
16166 return _py_anon_pod1.from_ptr(<intptr_t>&(self._ptr[0].utilization), 8, self._readonly) 1f
16168 @utilization.setter
16169 def utilization(self, val):
16170 if self._readonly:
16171 raise ValueError("This GpuDynamicPstatesInfo instance is read-only")
16172 cdef _py_anon_pod1 val_ = val
16173 if len(val) != 8:
16174 raise ValueError(f"Expected length { 8 } for field utilization, got {len(val)}")
16175 memcpy(<void *>&(self._ptr[0].utilization), <void *>(val_._get_ptr()), sizeof(_anon_pod1) * 8)
16177 @property
16178 def flags_(self):
16179 """int: """
16180 return self._ptr[0].flags
16182 @flags_.setter
16183 def flags_(self, val):
16184 if self._readonly:
16185 raise ValueError("This GpuDynamicPstatesInfo instance is read-only")
16186 self._ptr[0].flags = val
16188 @staticmethod
16189 def from_data(data):
16190 """Create an GpuDynamicPstatesInfo instance wrapping the given NumPy array.
16192 Args:
16193 data (_numpy.ndarray): a single-element array of dtype `gpu_dynamic_pstates_info_dtype` holding the data.
16194 """
16195 return __from_data(data, "gpu_dynamic_pstates_info_dtype", gpu_dynamic_pstates_info_dtype, GpuDynamicPstatesInfo)
16197 @staticmethod
16198 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
16199 """Create an GpuDynamicPstatesInfo instance wrapping the given pointer.
16201 Args:
16202 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16203 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
16204 readonly (bool): whether the data is read-only (to the user). default is `False`.
16205 """
16206 if ptr == 0:
16207 raise ValueError("ptr must not be null (0)")
16208 cdef GpuDynamicPstatesInfo obj = GpuDynamicPstatesInfo.__new__(GpuDynamicPstatesInfo)
16209 if owner is None:
16210 obj._ptr = <nvmlGpuDynamicPstatesInfo_t *>malloc(sizeof(nvmlGpuDynamicPstatesInfo_t))
16211 if obj._ptr == NULL:
16212 raise MemoryError("Error allocating GpuDynamicPstatesInfo")
16213 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGpuDynamicPstatesInfo_t))
16214 obj._owner = None
16215 obj._owned = True
16216 else:
16217 obj._ptr = <nvmlGpuDynamicPstatesInfo_t *>ptr
16218 obj._owner = owner
16219 obj._owned = False
16220 obj._readonly = readonly
16221 return obj
16224cdef _get_vgpu_processes_utilization_info_v1_dtype_offsets():
16225 cdef nvmlVgpuProcessesUtilizationInfo_v1_t pod = nvmlVgpuProcessesUtilizationInfo_v1_t()
16226 return _numpy.dtype({
16227 'names': ['version', 'vgpu_process_count', 'last_seen_time_stamp', 'vgpu_proc_util_array'],
16228 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.intp],
16229 'offsets': [
16230 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
16231 (<intptr_t>&(pod.vgpuProcessCount)) - (<intptr_t>&pod),
16232 (<intptr_t>&(pod.lastSeenTimeStamp)) - (<intptr_t>&pod),
16233 (<intptr_t>&(pod.vgpuProcUtilArray)) - (<intptr_t>&pod),
16234 ],
16235 'itemsize': sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t),
16236 })
16238vgpu_processes_utilization_info_v1_dtype = _get_vgpu_processes_utilization_info_v1_dtype_offsets()
16240cdef class VgpuProcessesUtilizationInfo_v1:
16241 """Empty-initialize an instance of `nvmlVgpuProcessesUtilizationInfo_v1_t`.
16244 .. seealso:: `nvmlVgpuProcessesUtilizationInfo_v1_t`
16245 """
16246 cdef:
16247 nvmlVgpuProcessesUtilizationInfo_v1_t *_ptr
16248 object _owner
16249 bint _owned
16250 bint _readonly
16251 dict _refs
16253 def __init__(self):
16254 self._ptr = <nvmlVgpuProcessesUtilizationInfo_v1_t *>calloc(1, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t))
16255 if self._ptr == NULL:
16256 raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1")
16257 self._owner = None
16258 self._owned = True
16259 self._readonly = False
16260 self._refs = {}
16262 def __dealloc__(self):
16263 cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr
16264 if self._owned and self._ptr != NULL:
16265 ptr = self._ptr
16266 self._ptr = NULL
16267 free(ptr)
16269 def __repr__(self):
16270 return f"<{__name__}.VgpuProcessesUtilizationInfo_v1 object at {hex(id(self))}>"
16272 @property
16273 def ptr(self):
16274 """Get the pointer address to the data as Python :class:`int`."""
16275 return <intptr_t>(self._ptr)
16277 cdef intptr_t _get_ptr(self):
16278 return <intptr_t>(self._ptr)
16280 def __int__(self):
16281 return <intptr_t>(self._ptr)
16283 def __eq__(self, other):
16284 cdef VgpuProcessesUtilizationInfo_v1 other_
16285 if not isinstance(other, VgpuProcessesUtilizationInfo_v1):
16286 return False
16287 other_ = other
16288 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) == 0)
16290 def __setitem__(self, key, val):
16291 if key == 0 and isinstance(val, _numpy.ndarray):
16292 self._ptr = <nvmlVgpuProcessesUtilizationInfo_v1_t *>malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t))
16293 if self._ptr == NULL:
16294 raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1")
16295 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t))
16296 self._owner = None
16297 self._owned = True
16298 self._readonly = not val.flags.writeable
16299 else:
16300 setattr(self, key, val)
16302 @property
16303 def version(self):
16304 """int: The version number of this struct."""
16305 return self._ptr[0].version
16307 @version.setter
16308 def version(self, val):
16309 if self._readonly:
16310 raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only")
16311 self._ptr[0].version = val
16313 @property
16314 def last_seen_time_stamp(self):
16315 """int: Return only samples with timestamp greater than lastSeenTimeStamp."""
16316 return self._ptr[0].lastSeenTimeStamp
16318 @last_seen_time_stamp.setter
16319 def last_seen_time_stamp(self, val):
16320 if self._readonly:
16321 raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only")
16322 self._ptr[0].lastSeenTimeStamp = val
16324 @property
16325 def vgpu_proc_util_array(self):
16326 """int: The array (allocated by caller) in which utilization of processes running on vGPU instances are returned."""
16327 if self._ptr[0].vgpuProcUtilArray == NULL or self._ptr[0].vgpuProcessCount == 0:
16328 return []
16329 return VgpuProcessUtilizationInfo_v1.from_ptr(<intptr_t>(self._ptr[0].vgpuProcUtilArray), self._ptr[0].vgpuProcessCount)
16331 @vgpu_proc_util_array.setter
16332 def vgpu_proc_util_array(self, val):
16333 if self._readonly:
16334 raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only")
16335 cdef VgpuProcessUtilizationInfo_v1 arr = val
16336 self._ptr[0].vgpuProcUtilArray = <nvmlVgpuProcessUtilizationInfo_v1_t*><intptr_t>(arr._get_ptr())
16337 self._ptr[0].vgpuProcessCount = len(arr)
16338 self._refs["vgpu_proc_util_array"] = arr
16340 @staticmethod
16341 def from_data(data):
16342 """Create an VgpuProcessesUtilizationInfo_v1 instance wrapping the given NumPy array.
16344 Args:
16345 data (_numpy.ndarray): a single-element array of dtype `vgpu_processes_utilization_info_v1_dtype` holding the data.
16346 """
16347 return __from_data(data, "vgpu_processes_utilization_info_v1_dtype", vgpu_processes_utilization_info_v1_dtype, VgpuProcessesUtilizationInfo_v1)
16349 @staticmethod
16350 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
16351 """Create an VgpuProcessesUtilizationInfo_v1 instance wrapping the given pointer.
16353 Args:
16354 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16355 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
16356 readonly (bool): whether the data is read-only (to the user). default is `False`.
16357 """
16358 if ptr == 0:
16359 raise ValueError("ptr must not be null (0)")
16360 cdef VgpuProcessesUtilizationInfo_v1 obj = VgpuProcessesUtilizationInfo_v1.__new__(VgpuProcessesUtilizationInfo_v1)
16361 if owner is None:
16362 obj._ptr = <nvmlVgpuProcessesUtilizationInfo_v1_t *>malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t))
16363 if obj._ptr == NULL:
16364 raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1")
16365 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t))
16366 obj._owner = None
16367 obj._owned = True
16368 else:
16369 obj._ptr = <nvmlVgpuProcessesUtilizationInfo_v1_t *>ptr
16370 obj._owner = owner
16371 obj._owned = False
16372 obj._readonly = readonly
16373 obj._refs = {}
16374 return obj
16377vgpu_scheduler_params_dtype = _numpy.dtype((
16378 _numpy.dtype((_numpy.void, sizeof(nvmlVgpuSchedulerParams_t))),
16379 {
16380 "vgpu_sched_data_with_arr": (_py_anon_pod2_dtype, 0),
16381 "vgpu_sched_data": (_py_anon_pod3_dtype, 0),
16382 }
16383 ))
16386cdef class VgpuSchedulerParams:
16387 """Empty-initialize an instance of `nvmlVgpuSchedulerParams_t`.
16390 .. seealso:: `nvmlVgpuSchedulerParams_t`
16391 """
16392 cdef:
16393 nvmlVgpuSchedulerParams_t *_ptr
16394 object _owner
16395 bint _owned
16396 bint _readonly
16398 def __init__(self):
16399 self._ptr = <nvmlVgpuSchedulerParams_t *>calloc(1, sizeof(nvmlVgpuSchedulerParams_t))
16400 if self._ptr == NULL:
16401 raise MemoryError("Error allocating VgpuSchedulerParams")
16402 self._owner = None
16403 self._owned = True
16404 self._readonly = False
16406 def __dealloc__(self):
16407 cdef nvmlVgpuSchedulerParams_t *ptr
16408 if self._owned and self._ptr != NULL:
16409 ptr = self._ptr
16410 self._ptr = NULL
16411 free(ptr)
16413 def __repr__(self):
16414 return f"<{__name__}.VgpuSchedulerParams object at {hex(id(self))}>"
16416 @property
16417 def ptr(self):
16418 """Get the pointer address to the data as Python :class:`int`."""
16419 return <intptr_t>(self._ptr)
16421 cdef intptr_t _get_ptr(self):
16422 return <intptr_t>(self._ptr)
16424 def __int__(self):
16425 return <intptr_t>(self._ptr)
16427 def __eq__(self, other):
16428 cdef VgpuSchedulerParams other_
16429 if not isinstance(other, VgpuSchedulerParams):
16430 return False
16431 other_ = other
16432 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerParams_t)) == 0)
16434 def __setitem__(self, key, val):
16435 if key == 0 and isinstance(val, _numpy.ndarray):
16436 self._ptr = <nvmlVgpuSchedulerParams_t *>malloc(sizeof(nvmlVgpuSchedulerParams_t))
16437 if self._ptr == NULL:
16438 raise MemoryError("Error allocating VgpuSchedulerParams")
16439 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerParams_t))
16440 self._owner = None
16441 self._owned = True
16442 self._readonly = not val.flags.writeable
16443 else:
16444 setattr(self, key, val)
16446 @property
16447 def vgpu_sched_data_with_arr(self):
16448 """_py_anon_pod2: """
16449 return _py_anon_pod2.from_ptr(<intptr_t>&(self._ptr[0].vgpuSchedDataWithARR), self._readonly, self)
16451 @vgpu_sched_data_with_arr.setter
16452 def vgpu_sched_data_with_arr(self, val):
16453 if self._readonly:
16454 raise ValueError("This VgpuSchedulerParams instance is read-only")
16455 cdef _py_anon_pod2 val_ = val
16456 memcpy(<void *>&(self._ptr[0].vgpuSchedDataWithARR), <void *>(val_._get_ptr()), sizeof(_anon_pod2) * 1)
16458 @property
16459 def vgpu_sched_data(self):
16460 """_py_anon_pod3: """
16461 return _py_anon_pod3.from_ptr(<intptr_t>&(self._ptr[0].vgpuSchedData), self._readonly, self)
16463 @vgpu_sched_data.setter
16464 def vgpu_sched_data(self, val):
16465 if self._readonly:
16466 raise ValueError("This VgpuSchedulerParams instance is read-only")
16467 cdef _py_anon_pod3 val_ = val
16468 memcpy(<void *>&(self._ptr[0].vgpuSchedData), <void *>(val_._get_ptr()), sizeof(_anon_pod3) * 1)
16470 @staticmethod
16471 def from_data(data):
16472 """Create an VgpuSchedulerParams instance wrapping the given NumPy array.
16474 Args:
16475 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_params_dtype` holding the data.
16476 """
16477 return __from_data(data, "vgpu_scheduler_params_dtype", vgpu_scheduler_params_dtype, VgpuSchedulerParams)
16479 @staticmethod
16480 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
16481 """Create an VgpuSchedulerParams instance wrapping the given pointer.
16483 Args:
16484 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16485 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
16486 readonly (bool): whether the data is read-only (to the user). default is `False`.
16487 """
16488 if ptr == 0:
16489 raise ValueError("ptr must not be null (0)")
16490 cdef VgpuSchedulerParams obj = VgpuSchedulerParams.__new__(VgpuSchedulerParams)
16491 if owner is None:
16492 obj._ptr = <nvmlVgpuSchedulerParams_t *>malloc(sizeof(nvmlVgpuSchedulerParams_t))
16493 if obj._ptr == NULL:
16494 raise MemoryError("Error allocating VgpuSchedulerParams")
16495 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerParams_t))
16496 obj._owner = None
16497 obj._owned = True
16498 else:
16499 obj._ptr = <nvmlVgpuSchedulerParams_t *>ptr
16500 obj._owner = owner
16501 obj._owned = False
16502 obj._readonly = readonly
16503 return obj
16506vgpu_scheduler_set_params_dtype = _numpy.dtype((
16507 _numpy.dtype((_numpy.void, sizeof(nvmlVgpuSchedulerSetParams_t))),
16508 {
16509 "vgpu_sched_data_with_arr": (_py_anon_pod4_dtype, 0),
16510 "vgpu_sched_data": (_py_anon_pod5_dtype, 0),
16511 }
16512 ))
16515cdef class VgpuSchedulerSetParams:
16516 """Empty-initialize an instance of `nvmlVgpuSchedulerSetParams_t`.
16519 .. seealso:: `nvmlVgpuSchedulerSetParams_t`
16520 """
16521 cdef:
16522 nvmlVgpuSchedulerSetParams_t *_ptr
16523 object _owner
16524 bint _owned
16525 bint _readonly
16527 def __init__(self):
16528 self._ptr = <nvmlVgpuSchedulerSetParams_t *>calloc(1, sizeof(nvmlVgpuSchedulerSetParams_t))
16529 if self._ptr == NULL:
16530 raise MemoryError("Error allocating VgpuSchedulerSetParams")
16531 self._owner = None
16532 self._owned = True
16533 self._readonly = False
16535 def __dealloc__(self):
16536 cdef nvmlVgpuSchedulerSetParams_t *ptr
16537 if self._owned and self._ptr != NULL:
16538 ptr = self._ptr
16539 self._ptr = NULL
16540 free(ptr)
16542 def __repr__(self):
16543 return f"<{__name__}.VgpuSchedulerSetParams object at {hex(id(self))}>"
16545 @property
16546 def ptr(self):
16547 """Get the pointer address to the data as Python :class:`int`."""
16548 return <intptr_t>(self._ptr)
16550 cdef intptr_t _get_ptr(self):
16551 return <intptr_t>(self._ptr)
16553 def __int__(self):
16554 return <intptr_t>(self._ptr)
16556 def __eq__(self, other):
16557 cdef VgpuSchedulerSetParams other_
16558 if not isinstance(other, VgpuSchedulerSetParams):
16559 return False
16560 other_ = other
16561 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerSetParams_t)) == 0)
16563 def __setitem__(self, key, val):
16564 if key == 0 and isinstance(val, _numpy.ndarray):
16565 self._ptr = <nvmlVgpuSchedulerSetParams_t *>malloc(sizeof(nvmlVgpuSchedulerSetParams_t))
16566 if self._ptr == NULL:
16567 raise MemoryError("Error allocating VgpuSchedulerSetParams")
16568 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerSetParams_t))
16569 self._owner = None
16570 self._owned = True
16571 self._readonly = not val.flags.writeable
16572 else:
16573 setattr(self, key, val)
16575 @property
16576 def vgpu_sched_data_with_arr(self):
16577 """_py_anon_pod4: """
16578 return _py_anon_pod4.from_ptr(<intptr_t>&(self._ptr[0].vgpuSchedDataWithARR), self._readonly, self)
16580 @vgpu_sched_data_with_arr.setter
16581 def vgpu_sched_data_with_arr(self, val):
16582 if self._readonly:
16583 raise ValueError("This VgpuSchedulerSetParams instance is read-only")
16584 cdef _py_anon_pod4 val_ = val
16585 memcpy(<void *>&(self._ptr[0].vgpuSchedDataWithARR), <void *>(val_._get_ptr()), sizeof(_anon_pod4) * 1)
16587 @property
16588 def vgpu_sched_data(self):
16589 """_py_anon_pod5: """
16590 return _py_anon_pod5.from_ptr(<intptr_t>&(self._ptr[0].vgpuSchedData), self._readonly, self)
16592 @vgpu_sched_data.setter
16593 def vgpu_sched_data(self, val):
16594 if self._readonly:
16595 raise ValueError("This VgpuSchedulerSetParams instance is read-only")
16596 cdef _py_anon_pod5 val_ = val
16597 memcpy(<void *>&(self._ptr[0].vgpuSchedData), <void *>(val_._get_ptr()), sizeof(_anon_pod5) * 1)
16599 @staticmethod
16600 def from_data(data):
16601 """Create an VgpuSchedulerSetParams instance wrapping the given NumPy array.
16603 Args:
16604 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_set_params_dtype` holding the data.
16605 """
16606 return __from_data(data, "vgpu_scheduler_set_params_dtype", vgpu_scheduler_set_params_dtype, VgpuSchedulerSetParams)
16608 @staticmethod
16609 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
16610 """Create an VgpuSchedulerSetParams instance wrapping the given pointer.
16612 Args:
16613 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16614 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
16615 readonly (bool): whether the data is read-only (to the user). default is `False`.
16616 """
16617 if ptr == 0:
16618 raise ValueError("ptr must not be null (0)")
16619 cdef VgpuSchedulerSetParams obj = VgpuSchedulerSetParams.__new__(VgpuSchedulerSetParams)
16620 if owner is None:
16621 obj._ptr = <nvmlVgpuSchedulerSetParams_t *>malloc(sizeof(nvmlVgpuSchedulerSetParams_t))
16622 if obj._ptr == NULL:
16623 raise MemoryError("Error allocating VgpuSchedulerSetParams")
16624 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerSetParams_t))
16625 obj._owner = None
16626 obj._owned = True
16627 else:
16628 obj._ptr = <nvmlVgpuSchedulerSetParams_t *>ptr
16629 obj._owner = owner
16630 obj._owned = False
16631 obj._readonly = readonly
16632 return obj
16635cdef _get_vgpu_license_info_dtype_offsets():
16636 cdef nvmlVgpuLicenseInfo_t pod = nvmlVgpuLicenseInfo_t()
16637 return _numpy.dtype({
16638 'names': ['is_licensed', 'license_expiry', 'current_state'],
16639 'formats': [_numpy.uint8, vgpu_license_expiry_dtype, _numpy.uint32],
16640 'offsets': [
16641 (<intptr_t>&(pod.isLicensed)) - (<intptr_t>&pod),
16642 (<intptr_t>&(pod.licenseExpiry)) - (<intptr_t>&pod),
16643 (<intptr_t>&(pod.currentState)) - (<intptr_t>&pod),
16644 ],
16645 'itemsize': sizeof(nvmlVgpuLicenseInfo_t),
16646 })
16648vgpu_license_info_dtype = _get_vgpu_license_info_dtype_offsets()
16650cdef class VgpuLicenseInfo:
16651 """Empty-initialize an instance of `nvmlVgpuLicenseInfo_t`.
16654 .. seealso:: `nvmlVgpuLicenseInfo_t`
16655 """
16656 cdef:
16657 nvmlVgpuLicenseInfo_t *_ptr
16658 object _owner
16659 bint _owned
16660 bint _readonly
16662 def __init__(self):
16663 self._ptr = <nvmlVgpuLicenseInfo_t *>calloc(1, sizeof(nvmlVgpuLicenseInfo_t))
16664 if self._ptr == NULL:
16665 raise MemoryError("Error allocating VgpuLicenseInfo")
16666 self._owner = None
16667 self._owned = True
16668 self._readonly = False
16670 def __dealloc__(self):
16671 cdef nvmlVgpuLicenseInfo_t *ptr
16672 if self._owned and self._ptr != NULL:
16673 ptr = self._ptr
16674 self._ptr = NULL
16675 free(ptr)
16677 def __repr__(self):
16678 return f"<{__name__}.VgpuLicenseInfo object at {hex(id(self))}>"
16680 @property
16681 def ptr(self):
16682 """Get the pointer address to the data as Python :class:`int`."""
16683 return <intptr_t>(self._ptr)
16685 cdef intptr_t _get_ptr(self):
16686 return <intptr_t>(self._ptr)
16688 def __int__(self):
16689 return <intptr_t>(self._ptr)
16691 def __eq__(self, other):
16692 cdef VgpuLicenseInfo other_
16693 if not isinstance(other, VgpuLicenseInfo):
16694 return False
16695 other_ = other
16696 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuLicenseInfo_t)) == 0)
16698 def __setitem__(self, key, val):
16699 if key == 0 and isinstance(val, _numpy.ndarray):
16700 self._ptr = <nvmlVgpuLicenseInfo_t *>malloc(sizeof(nvmlVgpuLicenseInfo_t))
16701 if self._ptr == NULL:
16702 raise MemoryError("Error allocating VgpuLicenseInfo")
16703 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuLicenseInfo_t))
16704 self._owner = None
16705 self._owned = True
16706 self._readonly = not val.flags.writeable
16707 else:
16708 setattr(self, key, val)
16710 @property
16711 def license_expiry(self):
16712 """VgpuLicenseExpiry: """
16713 return VgpuLicenseExpiry.from_ptr(<intptr_t>&(self._ptr[0].licenseExpiry), self._readonly, self)
16715 @license_expiry.setter
16716 def license_expiry(self, val):
16717 if self._readonly:
16718 raise ValueError("This VgpuLicenseInfo instance is read-only")
16719 cdef VgpuLicenseExpiry val_ = val
16720 memcpy(<void *>&(self._ptr[0].licenseExpiry), <void *>(val_._get_ptr()), sizeof(nvmlVgpuLicenseExpiry_t) * 1)
16722 @property
16723 def is_licensed(self):
16724 """int: """
16725 return self._ptr[0].isLicensed
16727 @is_licensed.setter
16728 def is_licensed(self, val):
16729 if self._readonly:
16730 raise ValueError("This VgpuLicenseInfo instance is read-only")
16731 self._ptr[0].isLicensed = val
16733 @property
16734 def current_state(self):
16735 """int: """
16736 return self._ptr[0].currentState
16738 @current_state.setter
16739 def current_state(self, val):
16740 if self._readonly:
16741 raise ValueError("This VgpuLicenseInfo instance is read-only")
16742 self._ptr[0].currentState = val
16744 @staticmethod
16745 def from_data(data):
16746 """Create an VgpuLicenseInfo instance wrapping the given NumPy array.
16748 Args:
16749 data (_numpy.ndarray): a single-element array of dtype `vgpu_license_info_dtype` holding the data.
16750 """
16751 return __from_data(data, "vgpu_license_info_dtype", vgpu_license_info_dtype, VgpuLicenseInfo)
16753 @staticmethod
16754 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
16755 """Create an VgpuLicenseInfo instance wrapping the given pointer.
16757 Args:
16758 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16759 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
16760 readonly (bool): whether the data is read-only (to the user). default is `False`.
16761 """
16762 if ptr == 0:
16763 raise ValueError("ptr must not be null (0)")
16764 cdef VgpuLicenseInfo obj = VgpuLicenseInfo.__new__(VgpuLicenseInfo)
16765 if owner is None:
16766 obj._ptr = <nvmlVgpuLicenseInfo_t *>malloc(sizeof(nvmlVgpuLicenseInfo_t))
16767 if obj._ptr == NULL:
16768 raise MemoryError("Error allocating VgpuLicenseInfo")
16769 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuLicenseInfo_t))
16770 obj._owner = None
16771 obj._owned = True
16772 else:
16773 obj._ptr = <nvmlVgpuLicenseInfo_t *>ptr
16774 obj._owner = owner
16775 obj._owned = False
16776 obj._readonly = readonly
16777 return obj
16780cdef _get_grid_licensable_feature_dtype_offsets():
16781 cdef nvmlGridLicensableFeature_t pod = nvmlGridLicensableFeature_t()
16782 return _numpy.dtype({
16783 'names': ['feature_code', 'feature_state', 'license_info', 'product_name', 'feature_enabled', 'license_expiry'],
16784 'formats': [_numpy.int32, _numpy.uint32, (_numpy.int8, 128), (_numpy.int8, 128), _numpy.uint32, grid_license_expiry_dtype],
16785 'offsets': [
16786 (<intptr_t>&(pod.featureCode)) - (<intptr_t>&pod),
16787 (<intptr_t>&(pod.featureState)) - (<intptr_t>&pod),
16788 (<intptr_t>&(pod.licenseInfo)) - (<intptr_t>&pod),
16789 (<intptr_t>&(pod.productName)) - (<intptr_t>&pod),
16790 (<intptr_t>&(pod.featureEnabled)) - (<intptr_t>&pod),
16791 (<intptr_t>&(pod.licenseExpiry)) - (<intptr_t>&pod),
16792 ],
16793 'itemsize': sizeof(nvmlGridLicensableFeature_t),
16794 })
16796grid_licensable_feature_dtype = _get_grid_licensable_feature_dtype_offsets()
16798cdef class GridLicensableFeature:
16799 """Empty-initialize an array of `nvmlGridLicensableFeature_t`.
16801 The resulting object is of length `size` and of dtype `grid_licensable_feature_dtype`.
16802 If default-constructed, the instance represents a single struct.
16804 Args:
16805 size (int): number of structs, default=1.
16808 .. seealso:: `nvmlGridLicensableFeature_t`
16809 """
16810 cdef:
16811 readonly object _data
16815 def __init__(self, size=1):
16816 arr = _numpy.empty(size, dtype=grid_licensable_feature_dtype)
16817 self._data = arr.view(_numpy.recarray)
16818 assert self._data.itemsize == sizeof(nvmlGridLicensableFeature_t), \
16819 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlGridLicensableFeature_t) }"
16821 def __repr__(self):
16822 if self._data.size > 1:
16823 return f"<{__name__}.GridLicensableFeature_Array_{self._data.size} object at {hex(id(self))}>"
16824 else:
16825 return f"<{__name__}.GridLicensableFeature object at {hex(id(self))}>"
16827 @property
16828 def ptr(self):
16829 """Get the pointer address to the data as Python :class:`int`."""
16830 return self._data.ctypes.data
16832 cdef intptr_t _get_ptr(self):
16833 return self._data.ctypes.data
16835 def __int__(self):
16836 if self._data.size > 1:
16837 raise TypeError("int() argument must be a bytes-like object of size 1. "
16838 "To get the pointer address of an array, use .ptr")
16839 return self._data.ctypes.data
16841 def __len__(self):
16842 return self._data.size 1x
16844 def __eq__(self, other):
16845 cdef object self_data = self._data
16846 if (not isinstance(other, GridLicensableFeature)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
16847 return False
16848 return bool((self_data == other._data).all())
16850 @property
16851 def feature_code(self):
16852 """Union[~_numpy.int32, int]: """
16853 if self._data.size == 1:
16854 return int(self._data.feature_code[0])
16855 return self._data.feature_code
16857 @feature_code.setter
16858 def feature_code(self, val):
16859 self._data.feature_code = val
16861 @property
16862 def feature_state(self):
16863 """Union[~_numpy.uint32, int]: """
16864 if self._data.size == 1:
16865 return int(self._data.feature_state[0])
16866 return self._data.feature_state
16868 @feature_state.setter
16869 def feature_state(self, val):
16870 self._data.feature_state = val
16872 @property
16873 def license_info(self):
16874 """~_numpy.int8: (array of length 128)."""
16875 return self._data.license_info
16877 @license_info.setter
16878 def license_info(self, val):
16879 self._data.license_info = val
16881 @property
16882 def product_name(self):
16883 """~_numpy.int8: (array of length 128)."""
16884 return self._data.product_name
16886 @product_name.setter
16887 def product_name(self, val):
16888 self._data.product_name = val
16890 @property
16891 def feature_enabled(self):
16892 """Union[~_numpy.uint32, int]: """
16893 if self._data.size == 1:
16894 return int(self._data.feature_enabled[0])
16895 return self._data.feature_enabled
16897 @feature_enabled.setter
16898 def feature_enabled(self, val):
16899 self._data.feature_enabled = val
16901 @property
16902 def license_expiry(self):
16903 """grid_license_expiry_dtype: """
16904 return self._data.license_expiry
16906 @license_expiry.setter
16907 def license_expiry(self, val):
16908 self._data.license_expiry = val
16910 def __getitem__(self, key):
16911 cdef ssize_t key_
16912 cdef ssize_t size
16913 if isinstance(key, int): 1x
16914 key_ = key 1x
16915 size = self._data.size 1x
16916 if key_ >= size or key_ <= -(size+1): 1x
16917 raise IndexError("index is out of bounds") 1x
16918 if key_ < 0:
16919 key_ += size
16920 return GridLicensableFeature.from_data(self._data[key_:key_+1])
16921 out = self._data[key]
16922 if isinstance(out, _numpy.recarray) and out.dtype == grid_licensable_feature_dtype:
16923 return GridLicensableFeature.from_data(out)
16924 return out
16926 def __setitem__(self, key, val):
16927 self._data[key] = val
16929 @staticmethod
16930 def from_data(data):
16931 """Create an GridLicensableFeature instance wrapping the given NumPy array.
16933 Args:
16934 data (_numpy.ndarray): a 1D array of dtype `grid_licensable_feature_dtype` holding the data.
16935 """
16936 cdef GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature)
16937 if not isinstance(data, _numpy.ndarray):
16938 raise TypeError("data argument must be a NumPy ndarray")
16939 if data.ndim != 1:
16940 raise ValueError("data array must be 1D")
16941 if data.dtype != grid_licensable_feature_dtype:
16942 raise ValueError("data array must be of dtype grid_licensable_feature_dtype")
16943 obj._data = data.view(_numpy.recarray)
16945 return obj
16947 @staticmethod
16948 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
16949 """Create an GridLicensableFeature instance wrapping the given pointer.
16951 Args:
16952 ptr (intptr_t): pointer address as Python :class:`int` to the data.
16953 size (int): number of structs, default=1.
16954 readonly (bool): whether the data is read-only (to the user). default is `False`.
16955 """
16956 if ptr == 0: 1x
16957 raise ValueError("ptr must not be null (0)")
16958 cdef GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature) 1x
16959 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE 1x
16960 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory( 1x
16961 <char*>ptr, sizeof(nvmlGridLicensableFeature_t) * size, flag) 1x
16962 data = _numpy.ndarray(size, buffer=buf, dtype=grid_licensable_feature_dtype) 1x
16963 obj._data = data.view(_numpy.recarray) 1x
16965 return obj 1x
16968cdef _get_unit_fan_speeds_dtype_offsets():
16969 cdef nvmlUnitFanSpeeds_t pod = nvmlUnitFanSpeeds_t()
16970 return _numpy.dtype({
16971 'names': ['fans', 'count'],
16972 'formats': [(unit_fan_info_dtype, 24), _numpy.uint32],
16973 'offsets': [
16974 (<intptr_t>&(pod.fans)) - (<intptr_t>&pod),
16975 (<intptr_t>&(pod.count)) - (<intptr_t>&pod),
16976 ],
16977 'itemsize': sizeof(nvmlUnitFanSpeeds_t),
16978 })
16980unit_fan_speeds_dtype = _get_unit_fan_speeds_dtype_offsets()
16982cdef class UnitFanSpeeds:
16983 """Empty-initialize an instance of `nvmlUnitFanSpeeds_t`.
16986 .. seealso:: `nvmlUnitFanSpeeds_t`
16987 """
16988 cdef:
16989 nvmlUnitFanSpeeds_t *_ptr
16990 object _owner
16991 bint _owned
16992 bint _readonly
16994 def __init__(self):
16995 self._ptr = <nvmlUnitFanSpeeds_t *>calloc(1, sizeof(nvmlUnitFanSpeeds_t))
16996 if self._ptr == NULL:
16997 raise MemoryError("Error allocating UnitFanSpeeds")
16998 self._owner = None
16999 self._owned = True
17000 self._readonly = False
17002 def __dealloc__(self):
17003 cdef nvmlUnitFanSpeeds_t *ptr
17004 if self._owned and self._ptr != NULL:
17005 ptr = self._ptr
17006 self._ptr = NULL
17007 free(ptr)
17009 def __repr__(self):
17010 return f"<{__name__}.UnitFanSpeeds object at {hex(id(self))}>"
17012 @property
17013 def ptr(self):
17014 """Get the pointer address to the data as Python :class:`int`."""
17015 return <intptr_t>(self._ptr)
17017 cdef intptr_t _get_ptr(self):
17018 return <intptr_t>(self._ptr)
17020 def __int__(self):
17021 return <intptr_t>(self._ptr)
17023 def __eq__(self, other):
17024 cdef UnitFanSpeeds other_
17025 if not isinstance(other, UnitFanSpeeds):
17026 return False
17027 other_ = other
17028 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlUnitFanSpeeds_t)) == 0)
17030 def __setitem__(self, key, val):
17031 if key == 0 and isinstance(val, _numpy.ndarray):
17032 self._ptr = <nvmlUnitFanSpeeds_t *>malloc(sizeof(nvmlUnitFanSpeeds_t))
17033 if self._ptr == NULL:
17034 raise MemoryError("Error allocating UnitFanSpeeds")
17035 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlUnitFanSpeeds_t))
17036 self._owner = None
17037 self._owned = True
17038 self._readonly = not val.flags.writeable
17039 else:
17040 setattr(self, key, val)
17042 @property
17043 def fans(self):
17044 """UnitFanInfo: """
17045 return UnitFanInfo.from_ptr(<intptr_t>&(self._ptr[0].fans), 24, self._readonly)
17047 @fans.setter
17048 def fans(self, val):
17049 if self._readonly:
17050 raise ValueError("This UnitFanSpeeds instance is read-only")
17051 cdef UnitFanInfo val_ = val
17052 if len(val) != 24:
17053 raise ValueError(f"Expected length { 24 } for field fans, got {len(val)}")
17054 memcpy(<void *>&(self._ptr[0].fans), <void *>(val_._get_ptr()), sizeof(nvmlUnitFanInfo_t) * 24)
17056 @property
17057 def count(self):
17058 """int: """
17059 return self._ptr[0].count
17061 @count.setter
17062 def count(self, val):
17063 if self._readonly:
17064 raise ValueError("This UnitFanSpeeds instance is read-only")
17065 self._ptr[0].count = val
17067 @staticmethod
17068 def from_data(data):
17069 """Create an UnitFanSpeeds instance wrapping the given NumPy array.
17071 Args:
17072 data (_numpy.ndarray): a single-element array of dtype `unit_fan_speeds_dtype` holding the data.
17073 """
17074 return __from_data(data, "unit_fan_speeds_dtype", unit_fan_speeds_dtype, UnitFanSpeeds)
17076 @staticmethod
17077 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
17078 """Create an UnitFanSpeeds instance wrapping the given pointer.
17080 Args:
17081 ptr (intptr_t): pointer address as Python :class:`int` to the data.
17082 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
17083 readonly (bool): whether the data is read-only (to the user). default is `False`.
17084 """
17085 if ptr == 0:
17086 raise ValueError("ptr must not be null (0)")
17087 cdef UnitFanSpeeds obj = UnitFanSpeeds.__new__(UnitFanSpeeds)
17088 if owner is None:
17089 obj._ptr = <nvmlUnitFanSpeeds_t *>malloc(sizeof(nvmlUnitFanSpeeds_t))
17090 if obj._ptr == NULL:
17091 raise MemoryError("Error allocating UnitFanSpeeds")
17092 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlUnitFanSpeeds_t))
17093 obj._owner = None
17094 obj._owned = True
17095 else:
17096 obj._ptr = <nvmlUnitFanSpeeds_t *>ptr
17097 obj._owner = owner
17098 obj._owned = False
17099 obj._readonly = readonly
17100 return obj
17103cdef _get_vgpu_pgpu_metadata_dtype_offsets():
17104 cdef nvmlVgpuPgpuMetadata_t pod = nvmlVgpuPgpuMetadata_t()
17105 return _numpy.dtype({
17106 'names': ['version', 'revision', 'host_driver_version', 'pgpu_virtualization_caps', 'reserved', 'host_supported_vgpu_range', 'opaque_data_size', 'opaque_data'],
17107 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.int8, 80), _numpy.uint32, (_numpy.uint32, 5), vgpu_version_dtype, _numpy.uint32, (_numpy.int8, 4)],
17108 'offsets': [
17109 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
17110 (<intptr_t>&(pod.revision)) - (<intptr_t>&pod),
17111 (<intptr_t>&(pod.hostDriverVersion)) - (<intptr_t>&pod),
17112 (<intptr_t>&(pod.pgpuVirtualizationCaps)) - (<intptr_t>&pod),
17113 (<intptr_t>&(pod.reserved)) - (<intptr_t>&pod),
17114 (<intptr_t>&(pod.hostSupportedVgpuRange)) - (<intptr_t>&pod),
17115 (<intptr_t>&(pod.opaqueDataSize)) - (<intptr_t>&pod),
17116 (<intptr_t>&(pod.opaqueData)) - (<intptr_t>&pod),
17117 ],
17118 'itemsize': sizeof(nvmlVgpuPgpuMetadata_t),
17119 })
17121vgpu_pgpu_metadata_dtype = _get_vgpu_pgpu_metadata_dtype_offsets()
17123cdef class VgpuPgpuMetadata:
17124 """Empty-initialize an instance of `nvmlVgpuPgpuMetadata_t`.
17127 .. seealso:: `nvmlVgpuPgpuMetadata_t`
17128 """
17129 cdef:
17130 nvmlVgpuPgpuMetadata_t *_ptr
17131 object _owner
17132 bint _owned
17133 bint _readonly
17135 def __init__(self):
17136 self._ptr = <nvmlVgpuPgpuMetadata_t *>calloc(1, sizeof(nvmlVgpuPgpuMetadata_t))
17137 if self._ptr == NULL:
17138 raise MemoryError("Error allocating VgpuPgpuMetadata")
17139 self._owner = None
17140 self._owned = True
17141 self._readonly = False
17143 def __dealloc__(self):
17144 cdef nvmlVgpuPgpuMetadata_t *ptr
17145 if self._owned and self._ptr != NULL:
17146 ptr = self._ptr
17147 self._ptr = NULL
17148 free(ptr)
17150 def __repr__(self):
17151 return f"<{__name__}.VgpuPgpuMetadata object at {hex(id(self))}>"
17153 @property
17154 def ptr(self):
17155 """Get the pointer address to the data as Python :class:`int`."""
17156 return <intptr_t>(self._ptr)
17158 cdef intptr_t _get_ptr(self):
17159 return <intptr_t>(self._ptr)
17161 def __int__(self):
17162 return <intptr_t>(self._ptr)
17164 def __eq__(self, other):
17165 cdef VgpuPgpuMetadata other_
17166 if not isinstance(other, VgpuPgpuMetadata):
17167 return False
17168 other_ = other
17169 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuPgpuMetadata_t)) == 0)
17171 def __setitem__(self, key, val):
17172 if key == 0 and isinstance(val, _numpy.ndarray):
17173 self._ptr = <nvmlVgpuPgpuMetadata_t *>malloc(sizeof(nvmlVgpuPgpuMetadata_t))
17174 if self._ptr == NULL:
17175 raise MemoryError("Error allocating VgpuPgpuMetadata")
17176 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuPgpuMetadata_t))
17177 self._owner = None
17178 self._owned = True
17179 self._readonly = not val.flags.writeable
17180 else:
17181 setattr(self, key, val)
17183 @property
17184 def host_supported_vgpu_range(self):
17185 """VgpuVersion: """
17186 return VgpuVersion.from_ptr(<intptr_t>&(self._ptr[0].hostSupportedVgpuRange), self._readonly, self)
17188 @host_supported_vgpu_range.setter
17189 def host_supported_vgpu_range(self, val):
17190 if self._readonly:
17191 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17192 cdef VgpuVersion val_ = val
17193 memcpy(<void *>&(self._ptr[0].hostSupportedVgpuRange), <void *>(val_._get_ptr()), sizeof(nvmlVgpuVersion_t) * 1)
17195 @property
17196 def version(self):
17197 """int: """
17198 return self._ptr[0].version
17200 @version.setter
17201 def version(self, val):
17202 if self._readonly:
17203 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17204 self._ptr[0].version = val
17206 @property
17207 def revision(self):
17208 """int: """
17209 return self._ptr[0].revision
17211 @revision.setter
17212 def revision(self, val):
17213 if self._readonly:
17214 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17215 self._ptr[0].revision = val
17217 @property
17218 def host_driver_version(self):
17219 """~_numpy.int8: (array of length 80)."""
17220 return cpython.PyUnicode_FromString(self._ptr[0].hostDriverVersion)
17222 @host_driver_version.setter
17223 def host_driver_version(self, val):
17224 if self._readonly:
17225 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17226 cdef bytes buf = val.encode()
17227 if len(buf) >= 80:
17228 raise ValueError("String too long for field host_driver_version, max length is 79")
17229 cdef char *ptr = buf
17230 memcpy(<void *>(self._ptr[0].hostDriverVersion), <void *>ptr, 80)
17232 @property
17233 def pgpu_virtualization_caps(self):
17234 """int: """
17235 return self._ptr[0].pgpuVirtualizationCaps
17237 @pgpu_virtualization_caps.setter
17238 def pgpu_virtualization_caps(self, val):
17239 if self._readonly:
17240 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17241 self._ptr[0].pgpuVirtualizationCaps = val
17243 @property
17244 def opaque_data_size(self):
17245 """int: """
17246 return self._ptr[0].opaqueDataSize
17248 @opaque_data_size.setter
17249 def opaque_data_size(self, val):
17250 if self._readonly:
17251 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17252 self._ptr[0].opaqueDataSize = val
17254 @property
17255 def opaque_data(self):
17256 """~_numpy.int8: (array of length 4)."""
17257 return cpython.PyUnicode_FromString(self._ptr[0].opaqueData)
17259 @opaque_data.setter
17260 def opaque_data(self, val):
17261 if self._readonly:
17262 raise ValueError("This VgpuPgpuMetadata instance is read-only")
17263 cdef bytes buf = val.encode()
17264 if len(buf) >= 4:
17265 raise ValueError("String too long for field opaque_data, max length is 3")
17266 cdef char *ptr = buf
17267 memcpy(<void *>(self._ptr[0].opaqueData), <void *>ptr, 4)
17269 @staticmethod
17270 def from_data(data):
17271 """Create an VgpuPgpuMetadata instance wrapping the given NumPy array.
17273 Args:
17274 data (_numpy.ndarray): a single-element array of dtype `vgpu_pgpu_metadata_dtype` holding the data.
17275 """
17276 return __from_data(data, "vgpu_pgpu_metadata_dtype", vgpu_pgpu_metadata_dtype, VgpuPgpuMetadata)
17278 @staticmethod
17279 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
17280 """Create an VgpuPgpuMetadata instance wrapping the given pointer.
17282 Args:
17283 ptr (intptr_t): pointer address as Python :class:`int` to the data.
17284 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
17285 readonly (bool): whether the data is read-only (to the user). default is `False`.
17286 """
17287 if ptr == 0:
17288 raise ValueError("ptr must not be null (0)")
17289 cdef VgpuPgpuMetadata obj = VgpuPgpuMetadata.__new__(VgpuPgpuMetadata)
17290 if owner is None:
17291 obj._ptr = <nvmlVgpuPgpuMetadata_t *>malloc(sizeof(nvmlVgpuPgpuMetadata_t))
17292 if obj._ptr == NULL:
17293 raise MemoryError("Error allocating VgpuPgpuMetadata")
17294 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuPgpuMetadata_t))
17295 obj._owner = None
17296 obj._owned = True
17297 else:
17298 obj._ptr = <nvmlVgpuPgpuMetadata_t *>ptr
17299 obj._owner = owner
17300 obj._owned = False
17301 obj._readonly = readonly
17302 return obj
17305cdef _get_gpu_instance_info_dtype_offsets():
17306 cdef nvmlGpuInstanceInfo_t pod = nvmlGpuInstanceInfo_t()
17307 return _numpy.dtype({
17308 'names': ['device_', 'id', 'profile_id', 'placement'],
17309 'formats': [_numpy.intp, _numpy.uint32, _numpy.uint32, gpu_instance_placement_dtype],
17310 'offsets': [
17311 (<intptr_t>&(pod.device)) - (<intptr_t>&pod),
17312 (<intptr_t>&(pod.id)) - (<intptr_t>&pod),
17313 (<intptr_t>&(pod.profileId)) - (<intptr_t>&pod),
17314 (<intptr_t>&(pod.placement)) - (<intptr_t>&pod),
17315 ],
17316 'itemsize': sizeof(nvmlGpuInstanceInfo_t),
17317 })
17319gpu_instance_info_dtype = _get_gpu_instance_info_dtype_offsets()
17321cdef class GpuInstanceInfo:
17322 """Empty-initialize an instance of `nvmlGpuInstanceInfo_t`.
17325 .. seealso:: `nvmlGpuInstanceInfo_t`
17326 """
17327 cdef:
17328 nvmlGpuInstanceInfo_t *_ptr
17329 object _owner
17330 bint _owned
17331 bint _readonly
17333 def __init__(self):
17334 self._ptr = <nvmlGpuInstanceInfo_t *>calloc(1, sizeof(nvmlGpuInstanceInfo_t))
17335 if self._ptr == NULL:
17336 raise MemoryError("Error allocating GpuInstanceInfo")
17337 self._owner = None
17338 self._owned = True
17339 self._readonly = False
17341 def __dealloc__(self):
17342 cdef nvmlGpuInstanceInfo_t *ptr
17343 if self._owned and self._ptr != NULL:
17344 ptr = self._ptr
17345 self._ptr = NULL
17346 free(ptr)
17348 def __repr__(self):
17349 return f"<{__name__}.GpuInstanceInfo object at {hex(id(self))}>"
17351 @property
17352 def ptr(self):
17353 """Get the pointer address to the data as Python :class:`int`."""
17354 return <intptr_t>(self._ptr)
17356 cdef intptr_t _get_ptr(self):
17357 return <intptr_t>(self._ptr)
17359 def __int__(self):
17360 return <intptr_t>(self._ptr)
17362 def __eq__(self, other):
17363 cdef GpuInstanceInfo other_
17364 if not isinstance(other, GpuInstanceInfo):
17365 return False
17366 other_ = other
17367 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGpuInstanceInfo_t)) == 0)
17369 def __setitem__(self, key, val):
17370 if key == 0 and isinstance(val, _numpy.ndarray):
17371 self._ptr = <nvmlGpuInstanceInfo_t *>malloc(sizeof(nvmlGpuInstanceInfo_t))
17372 if self._ptr == NULL:
17373 raise MemoryError("Error allocating GpuInstanceInfo")
17374 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGpuInstanceInfo_t))
17375 self._owner = None
17376 self._owned = True
17377 self._readonly = not val.flags.writeable
17378 else:
17379 setattr(self, key, val)
17381 @property
17382 def placement(self):
17383 """GpuInstancePlacement: """
17384 return GpuInstancePlacement.from_ptr(<intptr_t>&(self._ptr[0].placement), self._readonly, self)
17386 @placement.setter
17387 def placement(self, val):
17388 if self._readonly:
17389 raise ValueError("This GpuInstanceInfo instance is read-only")
17390 cdef GpuInstancePlacement val_ = val
17391 memcpy(<void *>&(self._ptr[0].placement), <void *>(val_._get_ptr()), sizeof(nvmlGpuInstancePlacement_t) * 1)
17393 @property
17394 def device_(self):
17395 """int: """
17396 return <intptr_t>(self._ptr[0].device)
17398 @device_.setter
17399 def device_(self, val):
17400 if self._readonly:
17401 raise ValueError("This GpuInstanceInfo instance is read-only")
17402 self._ptr[0].device = <nvmlDevice_t><intptr_t>val
17404 @property
17405 def id(self):
17406 """int: """
17407 return self._ptr[0].id
17409 @id.setter
17410 def id(self, val):
17411 if self._readonly:
17412 raise ValueError("This GpuInstanceInfo instance is read-only")
17413 self._ptr[0].id = val
17415 @property
17416 def profile_id(self):
17417 """int: """
17418 return self._ptr[0].profileId
17420 @profile_id.setter
17421 def profile_id(self, val):
17422 if self._readonly:
17423 raise ValueError("This GpuInstanceInfo instance is read-only")
17424 self._ptr[0].profileId = val
17426 @staticmethod
17427 def from_data(data):
17428 """Create an GpuInstanceInfo instance wrapping the given NumPy array.
17430 Args:
17431 data (_numpy.ndarray): a single-element array of dtype `gpu_instance_info_dtype` holding the data.
17432 """
17433 return __from_data(data, "gpu_instance_info_dtype", gpu_instance_info_dtype, GpuInstanceInfo)
17435 @staticmethod
17436 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
17437 """Create an GpuInstanceInfo instance wrapping the given pointer.
17439 Args:
17440 ptr (intptr_t): pointer address as Python :class:`int` to the data.
17441 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
17442 readonly (bool): whether the data is read-only (to the user). default is `False`.
17443 """
17444 if ptr == 0:
17445 raise ValueError("ptr must not be null (0)")
17446 cdef GpuInstanceInfo obj = GpuInstanceInfo.__new__(GpuInstanceInfo)
17447 if owner is None:
17448 obj._ptr = <nvmlGpuInstanceInfo_t *>malloc(sizeof(nvmlGpuInstanceInfo_t))
17449 if obj._ptr == NULL:
17450 raise MemoryError("Error allocating GpuInstanceInfo")
17451 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGpuInstanceInfo_t))
17452 obj._owner = None
17453 obj._owned = True
17454 else:
17455 obj._ptr = <nvmlGpuInstanceInfo_t *>ptr
17456 obj._owner = owner
17457 obj._owned = False
17458 obj._readonly = readonly
17459 return obj
17462cdef _get_compute_instance_info_dtype_offsets():
17463 cdef nvmlComputeInstanceInfo_t pod = nvmlComputeInstanceInfo_t()
17464 return _numpy.dtype({
17465 'names': ['device_', 'gpu_instance', 'id', 'profile_id', 'placement'],
17466 'formats': [_numpy.intp, _numpy.intp, _numpy.uint32, _numpy.uint32, compute_instance_placement_dtype],
17467 'offsets': [
17468 (<intptr_t>&(pod.device)) - (<intptr_t>&pod),
17469 (<intptr_t>&(pod.gpuInstance)) - (<intptr_t>&pod),
17470 (<intptr_t>&(pod.id)) - (<intptr_t>&pod),
17471 (<intptr_t>&(pod.profileId)) - (<intptr_t>&pod),
17472 (<intptr_t>&(pod.placement)) - (<intptr_t>&pod),
17473 ],
17474 'itemsize': sizeof(nvmlComputeInstanceInfo_t),
17475 })
17477compute_instance_info_dtype = _get_compute_instance_info_dtype_offsets()
17479cdef class ComputeInstanceInfo:
17480 """Empty-initialize an instance of `nvmlComputeInstanceInfo_t`.
17483 .. seealso:: `nvmlComputeInstanceInfo_t`
17484 """
17485 cdef:
17486 nvmlComputeInstanceInfo_t *_ptr
17487 object _owner
17488 bint _owned
17489 bint _readonly
17491 def __init__(self):
17492 self._ptr = <nvmlComputeInstanceInfo_t *>calloc(1, sizeof(nvmlComputeInstanceInfo_t))
17493 if self._ptr == NULL:
17494 raise MemoryError("Error allocating ComputeInstanceInfo")
17495 self._owner = None
17496 self._owned = True
17497 self._readonly = False
17499 def __dealloc__(self):
17500 cdef nvmlComputeInstanceInfo_t *ptr
17501 if self._owned and self._ptr != NULL:
17502 ptr = self._ptr
17503 self._ptr = NULL
17504 free(ptr)
17506 def __repr__(self):
17507 return f"<{__name__}.ComputeInstanceInfo object at {hex(id(self))}>"
17509 @property
17510 def ptr(self):
17511 """Get the pointer address to the data as Python :class:`int`."""
17512 return <intptr_t>(self._ptr)
17514 cdef intptr_t _get_ptr(self):
17515 return <intptr_t>(self._ptr)
17517 def __int__(self):
17518 return <intptr_t>(self._ptr)
17520 def __eq__(self, other):
17521 cdef ComputeInstanceInfo other_
17522 if not isinstance(other, ComputeInstanceInfo):
17523 return False
17524 other_ = other
17525 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlComputeInstanceInfo_t)) == 0)
17527 def __setitem__(self, key, val):
17528 if key == 0 and isinstance(val, _numpy.ndarray):
17529 self._ptr = <nvmlComputeInstanceInfo_t *>malloc(sizeof(nvmlComputeInstanceInfo_t))
17530 if self._ptr == NULL:
17531 raise MemoryError("Error allocating ComputeInstanceInfo")
17532 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlComputeInstanceInfo_t))
17533 self._owner = None
17534 self._owned = True
17535 self._readonly = not val.flags.writeable
17536 else:
17537 setattr(self, key, val)
17539 @property
17540 def placement(self):
17541 """ComputeInstancePlacement: """
17542 return ComputeInstancePlacement.from_ptr(<intptr_t>&(self._ptr[0].placement), self._readonly, self)
17544 @placement.setter
17545 def placement(self, val):
17546 if self._readonly:
17547 raise ValueError("This ComputeInstanceInfo instance is read-only")
17548 cdef ComputeInstancePlacement val_ = val
17549 memcpy(<void *>&(self._ptr[0].placement), <void *>(val_._get_ptr()), sizeof(nvmlComputeInstancePlacement_t) * 1)
17551 @property
17552 def device_(self):
17553 """int: """
17554 return <intptr_t>(self._ptr[0].device)
17556 @device_.setter
17557 def device_(self, val):
17558 if self._readonly:
17559 raise ValueError("This ComputeInstanceInfo instance is read-only")
17560 self._ptr[0].device = <nvmlDevice_t><intptr_t>val
17562 @property
17563 def gpu_instance(self):
17564 """int: """
17565 return <intptr_t>(self._ptr[0].gpuInstance)
17567 @gpu_instance.setter
17568 def gpu_instance(self, val):
17569 if self._readonly:
17570 raise ValueError("This ComputeInstanceInfo instance is read-only")
17571 self._ptr[0].gpuInstance = <nvmlGpuInstance_t><intptr_t>val
17573 @property
17574 def id(self):
17575 """int: """
17576 return self._ptr[0].id
17578 @id.setter
17579 def id(self, val):
17580 if self._readonly:
17581 raise ValueError("This ComputeInstanceInfo instance is read-only")
17582 self._ptr[0].id = val
17584 @property
17585 def profile_id(self):
17586 """int: """
17587 return self._ptr[0].profileId
17589 @profile_id.setter
17590 def profile_id(self, val):
17591 if self._readonly:
17592 raise ValueError("This ComputeInstanceInfo instance is read-only")
17593 self._ptr[0].profileId = val
17595 @staticmethod
17596 def from_data(data):
17597 """Create an ComputeInstanceInfo instance wrapping the given NumPy array.
17599 Args:
17600 data (_numpy.ndarray): a single-element array of dtype `compute_instance_info_dtype` holding the data.
17601 """
17602 return __from_data(data, "compute_instance_info_dtype", compute_instance_info_dtype, ComputeInstanceInfo)
17604 @staticmethod
17605 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
17606 """Create an ComputeInstanceInfo instance wrapping the given pointer.
17608 Args:
17609 ptr (intptr_t): pointer address as Python :class:`int` to the data.
17610 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
17611 readonly (bool): whether the data is read-only (to the user). default is `False`.
17612 """
17613 if ptr == 0:
17614 raise ValueError("ptr must not be null (0)")
17615 cdef ComputeInstanceInfo obj = ComputeInstanceInfo.__new__(ComputeInstanceInfo)
17616 if owner is None:
17617 obj._ptr = <nvmlComputeInstanceInfo_t *>malloc(sizeof(nvmlComputeInstanceInfo_t))
17618 if obj._ptr == NULL:
17619 raise MemoryError("Error allocating ComputeInstanceInfo")
17620 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlComputeInstanceInfo_t))
17621 obj._owner = None
17622 obj._owned = True
17623 else:
17624 obj._ptr = <nvmlComputeInstanceInfo_t *>ptr
17625 obj._owner = owner
17626 obj._owned = False
17627 obj._readonly = readonly
17628 return obj
17631cdef _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets():
17632 cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t pod = nvmlEccSramUniqueUncorrectedErrorCounts_v1_t()
17633 return _numpy.dtype({
17634 'names': ['version', 'entry_count', 'entries'],
17635 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp],
17636 'offsets': [
17637 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
17638 (<intptr_t>&(pod.entryCount)) - (<intptr_t>&pod),
17639 (<intptr_t>&(pod.entries)) - (<intptr_t>&pod),
17640 ],
17641 'itemsize': sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t),
17642 })
17644ecc_sram_unique_uncorrected_error_counts_v1_dtype = _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets()
17646cdef class EccSramUniqueUncorrectedErrorCounts_v1:
17647 """Empty-initialize an instance of `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t`.
17650 .. seealso:: `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t`
17651 """
17652 cdef:
17653 nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *_ptr
17654 object _owner
17655 bint _owned
17656 bint _readonly
17657 dict _refs
17659 def __init__(self):
17660 self._ptr = <nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *>calloc(1, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t))
17661 if self._ptr == NULL:
17662 raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1")
17663 self._owner = None
17664 self._owned = True
17665 self._readonly = False
17666 self._refs = {}
17668 def __dealloc__(self):
17669 cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr
17670 if self._owned and self._ptr != NULL:
17671 ptr = self._ptr
17672 self._ptr = NULL
17673 free(ptr)
17675 def __repr__(self):
17676 return f"<{__name__}.EccSramUniqueUncorrectedErrorCounts_v1 object at {hex(id(self))}>"
17678 @property
17679 def ptr(self):
17680 """Get the pointer address to the data as Python :class:`int`."""
17681 return <intptr_t>(self._ptr)
17683 cdef intptr_t _get_ptr(self):
17684 return <intptr_t>(self._ptr)
17686 def __int__(self):
17687 return <intptr_t>(self._ptr)
17689 def __eq__(self, other):
17690 cdef EccSramUniqueUncorrectedErrorCounts_v1 other_
17691 if not isinstance(other, EccSramUniqueUncorrectedErrorCounts_v1):
17692 return False
17693 other_ = other
17694 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) == 0)
17696 def __setitem__(self, key, val):
17697 if key == 0 and isinstance(val, _numpy.ndarray):
17698 self._ptr = <nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *>malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t))
17699 if self._ptr == NULL:
17700 raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1")
17701 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t))
17702 self._owner = None
17703 self._owned = True
17704 self._readonly = not val.flags.writeable
17705 else:
17706 setattr(self, key, val)
17708 @property
17709 def version(self):
17710 """int: the API version number"""
17711 return self._ptr[0].version
17713 @version.setter
17714 def version(self, val):
17715 if self._readonly:
17716 raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only")
17717 self._ptr[0].version = val
17719 @property
17720 def entries(self):
17721 """int: pointer to caller-supplied buffer to return the SRAM unique uncorrected ECC error count entries"""
17722 if self._ptr[0].entries == NULL or self._ptr[0].entryCount == 0:
17723 return []
17724 return EccSramUniqueUncorrectedErrorEntry_v1.from_ptr(<intptr_t>(self._ptr[0].entries), self._ptr[0].entryCount)
17726 @entries.setter
17727 def entries(self, val):
17728 if self._readonly:
17729 raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only")
17730 cdef EccSramUniqueUncorrectedErrorEntry_v1 arr = val
17731 self._ptr[0].entries = <nvmlEccSramUniqueUncorrectedErrorEntry_v1_t*><intptr_t>(arr._get_ptr())
17732 self._ptr[0].entryCount = len(arr)
17733 self._refs["entries"] = arr
17735 @staticmethod
17736 def from_data(data):
17737 """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance wrapping the given NumPy array.
17739 Args:
17740 data (_numpy.ndarray): a single-element array of dtype `ecc_sram_unique_uncorrected_error_counts_v1_dtype` holding the data.
17741 """
17742 return __from_data(data, "ecc_sram_unique_uncorrected_error_counts_v1_dtype", ecc_sram_unique_uncorrected_error_counts_v1_dtype, EccSramUniqueUncorrectedErrorCounts_v1)
17744 @staticmethod
17745 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
17746 """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance wrapping the given pointer.
17748 Args:
17749 ptr (intptr_t): pointer address as Python :class:`int` to the data.
17750 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
17751 readonly (bool): whether the data is read-only (to the user). default is `False`.
17752 """
17753 if ptr == 0:
17754 raise ValueError("ptr must not be null (0)")
17755 cdef EccSramUniqueUncorrectedErrorCounts_v1 obj = EccSramUniqueUncorrectedErrorCounts_v1.__new__(EccSramUniqueUncorrectedErrorCounts_v1)
17756 if owner is None:
17757 obj._ptr = <nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *>malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t))
17758 if obj._ptr == NULL:
17759 raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1")
17760 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t))
17761 obj._owner = None
17762 obj._owned = True
17763 else:
17764 obj._ptr = <nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *>ptr
17765 obj._owner = owner
17766 obj._owned = False
17767 obj._readonly = readonly
17768 obj._refs = {}
17769 return obj
17772cdef _get_nvlink_firmware_info_dtype_offsets():
17773 cdef nvmlNvlinkFirmwareInfo_t pod = nvmlNvlinkFirmwareInfo_t()
17774 return _numpy.dtype({
17775 'names': ['firmware_version', 'num_valid_entries'],
17776 'formats': [(nvlink_firmware_version_dtype, 100), _numpy.uint32],
17777 'offsets': [
17778 (<intptr_t>&(pod.firmwareVersion)) - (<intptr_t>&pod),
17779 (<intptr_t>&(pod.numValidEntries)) - (<intptr_t>&pod),
17780 ],
17781 'itemsize': sizeof(nvmlNvlinkFirmwareInfo_t),
17782 })
17784nvlink_firmware_info_dtype = _get_nvlink_firmware_info_dtype_offsets()
17786cdef class NvlinkFirmwareInfo:
17787 """Empty-initialize an instance of `nvmlNvlinkFirmwareInfo_t`.
17790 .. seealso:: `nvmlNvlinkFirmwareInfo_t`
17791 """
17792 cdef:
17793 nvmlNvlinkFirmwareInfo_t *_ptr
17794 object _owner
17795 bint _owned
17796 bint _readonly
17798 def __init__(self):
17799 self._ptr = <nvmlNvlinkFirmwareInfo_t *>calloc(1, sizeof(nvmlNvlinkFirmwareInfo_t))
17800 if self._ptr == NULL:
17801 raise MemoryError("Error allocating NvlinkFirmwareInfo")
17802 self._owner = None
17803 self._owned = True
17804 self._readonly = False
17806 def __dealloc__(self):
17807 cdef nvmlNvlinkFirmwareInfo_t *ptr
17808 if self._owned and self._ptr != NULL:
17809 ptr = self._ptr
17810 self._ptr = NULL
17811 free(ptr)
17813 def __repr__(self):
17814 return f"<{__name__}.NvlinkFirmwareInfo object at {hex(id(self))}>"
17816 @property
17817 def ptr(self):
17818 """Get the pointer address to the data as Python :class:`int`."""
17819 return <intptr_t>(self._ptr)
17821 cdef intptr_t _get_ptr(self):
17822 return <intptr_t>(self._ptr)
17824 def __int__(self):
17825 return <intptr_t>(self._ptr)
17827 def __eq__(self, other):
17828 cdef NvlinkFirmwareInfo other_
17829 if not isinstance(other, NvlinkFirmwareInfo):
17830 return False
17831 other_ = other
17832 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvlinkFirmwareInfo_t)) == 0)
17834 def __setitem__(self, key, val):
17835 if key == 0 and isinstance(val, _numpy.ndarray):
17836 self._ptr = <nvmlNvlinkFirmwareInfo_t *>malloc(sizeof(nvmlNvlinkFirmwareInfo_t))
17837 if self._ptr == NULL:
17838 raise MemoryError("Error allocating NvlinkFirmwareInfo")
17839 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvlinkFirmwareInfo_t))
17840 self._owner = None
17841 self._owned = True
17842 self._readonly = not val.flags.writeable
17843 else:
17844 setattr(self, key, val)
17846 @property
17847 def firmware_version(self):
17848 """NvlinkFirmwareVersion: OUT - NVLINK firmware version."""
17849 return NvlinkFirmwareVersion.from_ptr(<intptr_t>&(self._ptr[0].firmwareVersion), 100, self._readonly)
17851 @firmware_version.setter
17852 def firmware_version(self, val):
17853 if self._readonly:
17854 raise ValueError("This NvlinkFirmwareInfo instance is read-only")
17855 cdef NvlinkFirmwareVersion val_ = val
17856 if len(val) != 100:
17857 raise ValueError(f"Expected length { 100 } for field firmware_version, got {len(val)}")
17858 memcpy(<void *>&(self._ptr[0].firmwareVersion), <void *>(val_._get_ptr()), sizeof(nvmlNvlinkFirmwareVersion_t) * 100)
17860 @property
17861 def num_valid_entries(self):
17862 """int: OUT - Number of valid firmware entries."""
17863 return self._ptr[0].numValidEntries
17865 @num_valid_entries.setter
17866 def num_valid_entries(self, val):
17867 if self._readonly:
17868 raise ValueError("This NvlinkFirmwareInfo instance is read-only")
17869 self._ptr[0].numValidEntries = val
17871 @staticmethod
17872 def from_data(data):
17873 """Create an NvlinkFirmwareInfo instance wrapping the given NumPy array.
17875 Args:
17876 data (_numpy.ndarray): a single-element array of dtype `nvlink_firmware_info_dtype` holding the data.
17877 """
17878 return __from_data(data, "nvlink_firmware_info_dtype", nvlink_firmware_info_dtype, NvlinkFirmwareInfo)
17880 @staticmethod
17881 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
17882 """Create an NvlinkFirmwareInfo instance wrapping the given pointer.
17884 Args:
17885 ptr (intptr_t): pointer address as Python :class:`int` to the data.
17886 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
17887 readonly (bool): whether the data is read-only (to the user). default is `False`.
17888 """
17889 if ptr == 0:
17890 raise ValueError("ptr must not be null (0)")
17891 cdef NvlinkFirmwareInfo obj = NvlinkFirmwareInfo.__new__(NvlinkFirmwareInfo)
17892 if owner is None:
17893 obj._ptr = <nvmlNvlinkFirmwareInfo_t *>malloc(sizeof(nvmlNvlinkFirmwareInfo_t))
17894 if obj._ptr == NULL:
17895 raise MemoryError("Error allocating NvlinkFirmwareInfo")
17896 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvlinkFirmwareInfo_t))
17897 obj._owner = None
17898 obj._owned = True
17899 else:
17900 obj._ptr = <nvmlNvlinkFirmwareInfo_t *>ptr
17901 obj._owner = owner
17902 obj._owned = False
17903 obj._readonly = readonly
17904 return obj
17907cdef _get_vgpu_instances_utilization_info_v1_dtype_offsets():
17908 cdef nvmlVgpuInstancesUtilizationInfo_v1_t pod = nvmlVgpuInstancesUtilizationInfo_v1_t()
17909 return _numpy.dtype({
17910 'names': ['version', 'sample_val_type', 'vgpu_instance_count', 'last_seen_time_stamp', 'vgpu_util_array'],
17911 'formats': [_numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint64, _numpy.intp],
17912 'offsets': [
17913 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
17914 (<intptr_t>&(pod.sampleValType)) - (<intptr_t>&pod),
17915 (<intptr_t>&(pod.vgpuInstanceCount)) - (<intptr_t>&pod),
17916 (<intptr_t>&(pod.lastSeenTimeStamp)) - (<intptr_t>&pod),
17917 (<intptr_t>&(pod.vgpuUtilArray)) - (<intptr_t>&pod),
17918 ],
17919 'itemsize': sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t),
17920 })
17922vgpu_instances_utilization_info_v1_dtype = _get_vgpu_instances_utilization_info_v1_dtype_offsets()
17924cdef class VgpuInstancesUtilizationInfo_v1:
17925 """Empty-initialize an instance of `nvmlVgpuInstancesUtilizationInfo_v1_t`.
17928 .. seealso:: `nvmlVgpuInstancesUtilizationInfo_v1_t`
17929 """
17930 cdef:
17931 nvmlVgpuInstancesUtilizationInfo_v1_t *_ptr
17932 object _owner
17933 bint _owned
17934 bint _readonly
17935 dict _refs
17937 def __init__(self):
17938 self._ptr = <nvmlVgpuInstancesUtilizationInfo_v1_t *>calloc(1, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t))
17939 if self._ptr == NULL:
17940 raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1")
17941 self._owner = None
17942 self._owned = True
17943 self._readonly = False
17944 self._refs = {}
17946 def __dealloc__(self):
17947 cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr
17948 if self._owned and self._ptr != NULL:
17949 ptr = self._ptr
17950 self._ptr = NULL
17951 free(ptr)
17953 def __repr__(self):
17954 return f"<{__name__}.VgpuInstancesUtilizationInfo_v1 object at {hex(id(self))}>"
17956 @property
17957 def ptr(self):
17958 """Get the pointer address to the data as Python :class:`int`."""
17959 return <intptr_t>(self._ptr)
17961 cdef intptr_t _get_ptr(self):
17962 return <intptr_t>(self._ptr)
17964 def __int__(self):
17965 return <intptr_t>(self._ptr)
17967 def __eq__(self, other):
17968 cdef VgpuInstancesUtilizationInfo_v1 other_
17969 if not isinstance(other, VgpuInstancesUtilizationInfo_v1):
17970 return False
17971 other_ = other
17972 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) == 0)
17974 def __setitem__(self, key, val):
17975 if key == 0 and isinstance(val, _numpy.ndarray):
17976 self._ptr = <nvmlVgpuInstancesUtilizationInfo_v1_t *>malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t))
17977 if self._ptr == NULL:
17978 raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1")
17979 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t))
17980 self._owner = None
17981 self._owned = True
17982 self._readonly = not val.flags.writeable
17983 else:
17984 setattr(self, key, val)
17986 @property
17987 def version(self):
17988 """int: The version number of this struct."""
17989 return self._ptr[0].version
17991 @version.setter
17992 def version(self, val):
17993 if self._readonly:
17994 raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only")
17995 self._ptr[0].version = val
17997 @property
17998 def sample_val_type(self):
17999 """int: Hold the type of returned sample values."""
18000 return <int>(self._ptr[0].sampleValType)
18002 @sample_val_type.setter
18003 def sample_val_type(self, val):
18004 if self._readonly:
18005 raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only")
18006 self._ptr[0].sampleValType = <nvmlValueType_t><int>val
18008 @property
18009 def last_seen_time_stamp(self):
18010 """int: Return only samples with timestamp greater than lastSeenTimeStamp."""
18011 return self._ptr[0].lastSeenTimeStamp
18013 @last_seen_time_stamp.setter
18014 def last_seen_time_stamp(self, val):
18015 if self._readonly:
18016 raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only")
18017 self._ptr[0].lastSeenTimeStamp = val
18019 @property
18020 def vgpu_util_array(self):
18021 """int: The array (allocated by caller) in which vGPU utilization are returned."""
18022 if self._ptr[0].vgpuUtilArray == NULL or self._ptr[0].vgpuInstanceCount == 0:
18023 return []
18024 return VgpuInstanceUtilizationInfo_v1.from_ptr(<intptr_t>(self._ptr[0].vgpuUtilArray), self._ptr[0].vgpuInstanceCount)
18026 @vgpu_util_array.setter
18027 def vgpu_util_array(self, val):
18028 if self._readonly:
18029 raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only")
18030 cdef VgpuInstanceUtilizationInfo_v1 arr = val
18031 self._ptr[0].vgpuUtilArray = <nvmlVgpuInstanceUtilizationInfo_v1_t*><intptr_t>(arr._get_ptr())
18032 self._ptr[0].vgpuInstanceCount = len(arr)
18033 self._refs["vgpu_util_array"] = arr
18035 @staticmethod
18036 def from_data(data):
18037 """Create an VgpuInstancesUtilizationInfo_v1 instance wrapping the given NumPy array.
18039 Args:
18040 data (_numpy.ndarray): a single-element array of dtype `vgpu_instances_utilization_info_v1_dtype` holding the data.
18041 """
18042 return __from_data(data, "vgpu_instances_utilization_info_v1_dtype", vgpu_instances_utilization_info_v1_dtype, VgpuInstancesUtilizationInfo_v1)
18044 @staticmethod
18045 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
18046 """Create an VgpuInstancesUtilizationInfo_v1 instance wrapping the given pointer.
18048 Args:
18049 ptr (intptr_t): pointer address as Python :class:`int` to the data.
18050 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
18051 readonly (bool): whether the data is read-only (to the user). default is `False`.
18052 """
18053 if ptr == 0:
18054 raise ValueError("ptr must not be null (0)")
18055 cdef VgpuInstancesUtilizationInfo_v1 obj = VgpuInstancesUtilizationInfo_v1.__new__(VgpuInstancesUtilizationInfo_v1)
18056 if owner is None:
18057 obj._ptr = <nvmlVgpuInstancesUtilizationInfo_v1_t *>malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t))
18058 if obj._ptr == NULL:
18059 raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1")
18060 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t))
18061 obj._owner = None
18062 obj._owned = True
18063 else:
18064 obj._ptr = <nvmlVgpuInstancesUtilizationInfo_v1_t *>ptr
18065 obj._owner = owner
18066 obj._owned = False
18067 obj._readonly = readonly
18068 obj._refs = {}
18069 return obj
18072cdef _get_prm_counter_v1_dtype_offsets():
18073 cdef nvmlPRMCounter_v1_t pod = nvmlPRMCounter_v1_t()
18074 return _numpy.dtype({
18075 'names': ['counter_id', 'in_data', 'counter_value'],
18076 'formats': [_numpy.uint32, prm_counter_input_v1_dtype, prm_counter_value_v1_dtype],
18077 'offsets': [
18078 (<intptr_t>&(pod.counterId)) - (<intptr_t>&pod),
18079 (<intptr_t>&(pod.inData)) - (<intptr_t>&pod),
18080 (<intptr_t>&(pod.counterValue)) - (<intptr_t>&pod),
18081 ],
18082 'itemsize': sizeof(nvmlPRMCounter_v1_t),
18083 })
18085prm_counter_v1_dtype = _get_prm_counter_v1_dtype_offsets()
18087cdef class PRMCounter_v1:
18088 """Empty-initialize an array of `nvmlPRMCounter_v1_t`.
18090 The resulting object is of length `size` and of dtype `prm_counter_v1_dtype`.
18091 If default-constructed, the instance represents a single struct.
18093 Args:
18094 size (int): number of structs, default=1.
18097 .. seealso:: `nvmlPRMCounter_v1_t`
18098 """
18099 cdef:
18100 readonly object _data
18104 def __init__(self, size=1):
18105 arr = _numpy.empty(size, dtype=prm_counter_v1_dtype)
18106 self._data = arr.view(_numpy.recarray)
18107 assert self._data.itemsize == sizeof(nvmlPRMCounter_v1_t), \
18108 f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPRMCounter_v1_t) }"
18110 def __repr__(self):
18111 if self._data.size > 1:
18112 return f"<{__name__}.PRMCounter_v1_Array_{self._data.size} object at {hex(id(self))}>"
18113 else:
18114 return f"<{__name__}.PRMCounter_v1 object at {hex(id(self))}>"
18116 @property
18117 def ptr(self):
18118 """Get the pointer address to the data as Python :class:`int`."""
18119 return self._data.ctypes.data
18121 cdef intptr_t _get_ptr(self):
18122 return self._data.ctypes.data
18124 def __int__(self):
18125 if self._data.size > 1:
18126 raise TypeError("int() argument must be a bytes-like object of size 1. "
18127 "To get the pointer address of an array, use .ptr")
18128 return self._data.ctypes.data
18130 def __len__(self):
18131 return self._data.size
18133 def __eq__(self, other):
18134 cdef object self_data = self._data
18135 if (not isinstance(other, PRMCounter_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype:
18136 return False
18137 return bool((self_data == other._data).all())
18139 @property
18140 def counter_id(self):
18141 """Union[~_numpy.uint32, int]: Counter ID, one of nvmlPRMCounterId_t."""
18142 if self._data.size == 1:
18143 return int(self._data.counter_id[0])
18144 return self._data.counter_id
18146 @counter_id.setter
18147 def counter_id(self, val):
18148 self._data.counter_id = val
18150 @property
18151 def in_data(self):
18152 """prm_counter_input_v1_dtype: PRM input values."""
18153 return self._data.in_data
18155 @in_data.setter
18156 def in_data(self, val):
18157 self._data.in_data = val
18159 @property
18160 def counter_value(self):
18161 """prm_counter_value_v1_dtype: Counter value."""
18162 return self._data.counter_value
18164 @counter_value.setter
18165 def counter_value(self, val):
18166 self._data.counter_value = val
18168 def __getitem__(self, key):
18169 cdef ssize_t key_
18170 cdef ssize_t size
18171 if isinstance(key, int):
18172 key_ = key
18173 size = self._data.size
18174 if key_ >= size or key_ <= -(size+1):
18175 raise IndexError("index is out of bounds")
18176 if key_ < 0:
18177 key_ += size
18178 return PRMCounter_v1.from_data(self._data[key_:key_+1])
18179 out = self._data[key]
18180 if isinstance(out, _numpy.recarray) and out.dtype == prm_counter_v1_dtype:
18181 return PRMCounter_v1.from_data(out)
18182 return out
18184 def __setitem__(self, key, val):
18185 self._data[key] = val
18187 @staticmethod
18188 def from_data(data):
18189 """Create an PRMCounter_v1 instance wrapping the given NumPy array.
18191 Args:
18192 data (_numpy.ndarray): a 1D array of dtype `prm_counter_v1_dtype` holding the data.
18193 """
18194 cdef PRMCounter_v1 obj = PRMCounter_v1.__new__(PRMCounter_v1)
18195 if not isinstance(data, _numpy.ndarray):
18196 raise TypeError("data argument must be a NumPy ndarray")
18197 if data.ndim != 1:
18198 raise ValueError("data array must be 1D")
18199 if data.dtype != prm_counter_v1_dtype:
18200 raise ValueError("data array must be of dtype prm_counter_v1_dtype")
18201 obj._data = data.view(_numpy.recarray)
18203 return obj
18205 @staticmethod
18206 def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False):
18207 """Create an PRMCounter_v1 instance wrapping the given pointer.
18209 Args:
18210 ptr (intptr_t): pointer address as Python :class:`int` to the data.
18211 size (int): number of structs, default=1.
18212 readonly (bool): whether the data is read-only (to the user). default is `False`.
18213 """
18214 if ptr == 0:
18215 raise ValueError("ptr must not be null (0)")
18216 cdef PRMCounter_v1 obj = PRMCounter_v1.__new__(PRMCounter_v1)
18217 cdef flag = cpython.buffer.PyBUF_READ if readonly else cpython.buffer.PyBUF_WRITE
18218 cdef object buf = cpython.memoryview.PyMemoryView_FromMemory(
18219 <char*>ptr, sizeof(nvmlPRMCounter_v1_t) * size, flag)
18220 data = _numpy.ndarray(size, buffer=buf, dtype=prm_counter_v1_dtype)
18221 obj._data = data.view(_numpy.recarray)
18223 return obj
18226cdef _get_vgpu_scheduler_log_dtype_offsets():
18227 cdef nvmlVgpuSchedulerLog_t pod = nvmlVgpuSchedulerLog_t()
18228 return _numpy.dtype({
18229 'names': ['engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params', 'entries_count', 'log_entries'],
18230 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype, _numpy.uint32, (vgpu_scheduler_log_entry_dtype, 200)],
18231 'offsets': [
18232 (<intptr_t>&(pod.engineId)) - (<intptr_t>&pod),
18233 (<intptr_t>&(pod.schedulerPolicy)) - (<intptr_t>&pod),
18234 (<intptr_t>&(pod.arrMode)) - (<intptr_t>&pod),
18235 (<intptr_t>&(pod.schedulerParams)) - (<intptr_t>&pod),
18236 (<intptr_t>&(pod.entriesCount)) - (<intptr_t>&pod),
18237 (<intptr_t>&(pod.logEntries)) - (<intptr_t>&pod),
18238 ],
18239 'itemsize': sizeof(nvmlVgpuSchedulerLog_t),
18240 })
18242vgpu_scheduler_log_dtype = _get_vgpu_scheduler_log_dtype_offsets()
18244cdef class VgpuSchedulerLog:
18245 """Empty-initialize an instance of `nvmlVgpuSchedulerLog_t`.
18248 .. seealso:: `nvmlVgpuSchedulerLog_t`
18249 """
18250 cdef:
18251 nvmlVgpuSchedulerLog_t *_ptr
18252 object _owner
18253 bint _owned
18254 bint _readonly
18256 def __init__(self):
18257 self._ptr = <nvmlVgpuSchedulerLog_t *>calloc(1, sizeof(nvmlVgpuSchedulerLog_t))
18258 if self._ptr == NULL:
18259 raise MemoryError("Error allocating VgpuSchedulerLog")
18260 self._owner = None
18261 self._owned = True
18262 self._readonly = False
18264 def __dealloc__(self):
18265 cdef nvmlVgpuSchedulerLog_t *ptr
18266 if self._owned and self._ptr != NULL:
18267 ptr = self._ptr
18268 self._ptr = NULL
18269 free(ptr)
18271 def __repr__(self):
18272 return f"<{__name__}.VgpuSchedulerLog object at {hex(id(self))}>"
18274 @property
18275 def ptr(self):
18276 """Get the pointer address to the data as Python :class:`int`."""
18277 return <intptr_t>(self._ptr)
18279 cdef intptr_t _get_ptr(self):
18280 return <intptr_t>(self._ptr)
18282 def __int__(self):
18283 return <intptr_t>(self._ptr)
18285 def __eq__(self, other):
18286 cdef VgpuSchedulerLog other_
18287 if not isinstance(other, VgpuSchedulerLog):
18288 return False
18289 other_ = other
18290 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerLog_t)) == 0)
18292 def __setitem__(self, key, val):
18293 if key == 0 and isinstance(val, _numpy.ndarray):
18294 self._ptr = <nvmlVgpuSchedulerLog_t *>malloc(sizeof(nvmlVgpuSchedulerLog_t))
18295 if self._ptr == NULL:
18296 raise MemoryError("Error allocating VgpuSchedulerLog")
18297 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerLog_t))
18298 self._owner = None
18299 self._owned = True
18300 self._readonly = not val.flags.writeable
18301 else:
18302 setattr(self, key, val)
18304 @property
18305 def scheduler_params(self):
18306 """VgpuSchedulerParams: """
18307 return VgpuSchedulerParams.from_ptr(<intptr_t>&(self._ptr[0].schedulerParams), self._readonly, self)
18309 @scheduler_params.setter
18310 def scheduler_params(self, val):
18311 if self._readonly:
18312 raise ValueError("This VgpuSchedulerLog instance is read-only")
18313 cdef VgpuSchedulerParams val_ = val
18314 memcpy(<void *>&(self._ptr[0].schedulerParams), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1)
18316 @property
18317 def log_entries(self):
18318 """VgpuSchedulerLogEntry: """
18319 return VgpuSchedulerLogEntry.from_ptr(<intptr_t>&(self._ptr[0].logEntries), 200, self._readonly)
18321 @log_entries.setter
18322 def log_entries(self, val):
18323 if self._readonly:
18324 raise ValueError("This VgpuSchedulerLog instance is read-only")
18325 cdef VgpuSchedulerLogEntry val_ = val
18326 if len(val) != 200:
18327 raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}")
18328 memcpy(<void *>&(self._ptr[0].logEntries), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_t) * 200)
18330 @property
18331 def engine_id(self):
18332 """int: """
18333 return self._ptr[0].engineId
18335 @engine_id.setter
18336 def engine_id(self, val):
18337 if self._readonly:
18338 raise ValueError("This VgpuSchedulerLog instance is read-only")
18339 self._ptr[0].engineId = val
18341 @property
18342 def scheduler_policy(self):
18343 """int: """
18344 return self._ptr[0].schedulerPolicy
18346 @scheduler_policy.setter
18347 def scheduler_policy(self, val):
18348 if self._readonly:
18349 raise ValueError("This VgpuSchedulerLog instance is read-only")
18350 self._ptr[0].schedulerPolicy = val
18352 @property
18353 def arr_mode(self):
18354 """int: """
18355 return self._ptr[0].arrMode
18357 @arr_mode.setter
18358 def arr_mode(self, val):
18359 if self._readonly:
18360 raise ValueError("This VgpuSchedulerLog instance is read-only")
18361 self._ptr[0].arrMode = val
18363 @property
18364 def entries_count(self):
18365 """int: """
18366 return self._ptr[0].entriesCount
18368 @entries_count.setter
18369 def entries_count(self, val):
18370 if self._readonly:
18371 raise ValueError("This VgpuSchedulerLog instance is read-only")
18372 self._ptr[0].entriesCount = val
18374 @staticmethod
18375 def from_data(data):
18376 """Create an VgpuSchedulerLog instance wrapping the given NumPy array.
18378 Args:
18379 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_dtype` holding the data.
18380 """
18381 return __from_data(data, "vgpu_scheduler_log_dtype", vgpu_scheduler_log_dtype, VgpuSchedulerLog)
18383 @staticmethod
18384 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
18385 """Create an VgpuSchedulerLog instance wrapping the given pointer.
18387 Args:
18388 ptr (intptr_t): pointer address as Python :class:`int` to the data.
18389 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
18390 readonly (bool): whether the data is read-only (to the user). default is `False`.
18391 """
18392 if ptr == 0:
18393 raise ValueError("ptr must not be null (0)")
18394 cdef VgpuSchedulerLog obj = VgpuSchedulerLog.__new__(VgpuSchedulerLog)
18395 if owner is None:
18396 obj._ptr = <nvmlVgpuSchedulerLog_t *>malloc(sizeof(nvmlVgpuSchedulerLog_t))
18397 if obj._ptr == NULL:
18398 raise MemoryError("Error allocating VgpuSchedulerLog")
18399 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerLog_t))
18400 obj._owner = None
18401 obj._owned = True
18402 else:
18403 obj._ptr = <nvmlVgpuSchedulerLog_t *>ptr
18404 obj._owner = owner
18405 obj._owned = False
18406 obj._readonly = readonly
18407 return obj
18410cdef _get_vgpu_scheduler_get_state_dtype_offsets():
18411 cdef nvmlVgpuSchedulerGetState_t pod = nvmlVgpuSchedulerGetState_t()
18412 return _numpy.dtype({
18413 'names': ['scheduler_policy', 'arr_mode', 'scheduler_params'],
18414 'formats': [_numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype],
18415 'offsets': [
18416 (<intptr_t>&(pod.schedulerPolicy)) - (<intptr_t>&pod),
18417 (<intptr_t>&(pod.arrMode)) - (<intptr_t>&pod),
18418 (<intptr_t>&(pod.schedulerParams)) - (<intptr_t>&pod),
18419 ],
18420 'itemsize': sizeof(nvmlVgpuSchedulerGetState_t),
18421 })
18423vgpu_scheduler_get_state_dtype = _get_vgpu_scheduler_get_state_dtype_offsets()
18425cdef class VgpuSchedulerGetState:
18426 """Empty-initialize an instance of `nvmlVgpuSchedulerGetState_t`.
18429 .. seealso:: `nvmlVgpuSchedulerGetState_t`
18430 """
18431 cdef:
18432 nvmlVgpuSchedulerGetState_t *_ptr
18433 object _owner
18434 bint _owned
18435 bint _readonly
18437 def __init__(self):
18438 self._ptr = <nvmlVgpuSchedulerGetState_t *>calloc(1, sizeof(nvmlVgpuSchedulerGetState_t))
18439 if self._ptr == NULL:
18440 raise MemoryError("Error allocating VgpuSchedulerGetState")
18441 self._owner = None
18442 self._owned = True
18443 self._readonly = False
18445 def __dealloc__(self):
18446 cdef nvmlVgpuSchedulerGetState_t *ptr
18447 if self._owned and self._ptr != NULL:
18448 ptr = self._ptr
18449 self._ptr = NULL
18450 free(ptr)
18452 def __repr__(self):
18453 return f"<{__name__}.VgpuSchedulerGetState object at {hex(id(self))}>"
18455 @property
18456 def ptr(self):
18457 """Get the pointer address to the data as Python :class:`int`."""
18458 return <intptr_t>(self._ptr)
18460 cdef intptr_t _get_ptr(self):
18461 return <intptr_t>(self._ptr)
18463 def __int__(self):
18464 return <intptr_t>(self._ptr)
18466 def __eq__(self, other):
18467 cdef VgpuSchedulerGetState other_
18468 if not isinstance(other, VgpuSchedulerGetState):
18469 return False
18470 other_ = other
18471 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerGetState_t)) == 0)
18473 def __setitem__(self, key, val):
18474 if key == 0 and isinstance(val, _numpy.ndarray):
18475 self._ptr = <nvmlVgpuSchedulerGetState_t *>malloc(sizeof(nvmlVgpuSchedulerGetState_t))
18476 if self._ptr == NULL:
18477 raise MemoryError("Error allocating VgpuSchedulerGetState")
18478 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerGetState_t))
18479 self._owner = None
18480 self._owned = True
18481 self._readonly = not val.flags.writeable
18482 else:
18483 setattr(self, key, val)
18485 @property
18486 def scheduler_params(self):
18487 """VgpuSchedulerParams: """
18488 return VgpuSchedulerParams.from_ptr(<intptr_t>&(self._ptr[0].schedulerParams), self._readonly, self)
18490 @scheduler_params.setter
18491 def scheduler_params(self, val):
18492 if self._readonly:
18493 raise ValueError("This VgpuSchedulerGetState instance is read-only")
18494 cdef VgpuSchedulerParams val_ = val
18495 memcpy(<void *>&(self._ptr[0].schedulerParams), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1)
18497 @property
18498 def scheduler_policy(self):
18499 """int: """
18500 return self._ptr[0].schedulerPolicy
18502 @scheduler_policy.setter
18503 def scheduler_policy(self, val):
18504 if self._readonly:
18505 raise ValueError("This VgpuSchedulerGetState instance is read-only")
18506 self._ptr[0].schedulerPolicy = val
18508 @property
18509 def arr_mode(self):
18510 """int: """
18511 return self._ptr[0].arrMode
18513 @arr_mode.setter
18514 def arr_mode(self, val):
18515 if self._readonly:
18516 raise ValueError("This VgpuSchedulerGetState instance is read-only")
18517 self._ptr[0].arrMode = val
18519 @staticmethod
18520 def from_data(data):
18521 """Create an VgpuSchedulerGetState instance wrapping the given NumPy array.
18523 Args:
18524 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_get_state_dtype` holding the data.
18525 """
18526 return __from_data(data, "vgpu_scheduler_get_state_dtype", vgpu_scheduler_get_state_dtype, VgpuSchedulerGetState)
18528 @staticmethod
18529 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
18530 """Create an VgpuSchedulerGetState instance wrapping the given pointer.
18532 Args:
18533 ptr (intptr_t): pointer address as Python :class:`int` to the data.
18534 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
18535 readonly (bool): whether the data is read-only (to the user). default is `False`.
18536 """
18537 if ptr == 0:
18538 raise ValueError("ptr must not be null (0)")
18539 cdef VgpuSchedulerGetState obj = VgpuSchedulerGetState.__new__(VgpuSchedulerGetState)
18540 if owner is None:
18541 obj._ptr = <nvmlVgpuSchedulerGetState_t *>malloc(sizeof(nvmlVgpuSchedulerGetState_t))
18542 if obj._ptr == NULL:
18543 raise MemoryError("Error allocating VgpuSchedulerGetState")
18544 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerGetState_t))
18545 obj._owner = None
18546 obj._owned = True
18547 else:
18548 obj._ptr = <nvmlVgpuSchedulerGetState_t *>ptr
18549 obj._owner = owner
18550 obj._owned = False
18551 obj._readonly = readonly
18552 return obj
18555cdef _get_vgpu_scheduler_state_info_v1_dtype_offsets():
18556 cdef nvmlVgpuSchedulerStateInfo_v1_t pod = nvmlVgpuSchedulerStateInfo_v1_t()
18557 return _numpy.dtype({
18558 'names': ['version', 'engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params'],
18559 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype],
18560 'offsets': [
18561 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
18562 (<intptr_t>&(pod.engineId)) - (<intptr_t>&pod),
18563 (<intptr_t>&(pod.schedulerPolicy)) - (<intptr_t>&pod),
18564 (<intptr_t>&(pod.arrMode)) - (<intptr_t>&pod),
18565 (<intptr_t>&(pod.schedulerParams)) - (<intptr_t>&pod),
18566 ],
18567 'itemsize': sizeof(nvmlVgpuSchedulerStateInfo_v1_t),
18568 })
18570vgpu_scheduler_state_info_v1_dtype = _get_vgpu_scheduler_state_info_v1_dtype_offsets()
18572cdef class VgpuSchedulerStateInfo_v1:
18573 """Empty-initialize an instance of `nvmlVgpuSchedulerStateInfo_v1_t`.
18576 .. seealso:: `nvmlVgpuSchedulerStateInfo_v1_t`
18577 """
18578 cdef:
18579 nvmlVgpuSchedulerStateInfo_v1_t *_ptr
18580 object _owner
18581 bint _owned
18582 bint _readonly
18584 def __init__(self):
18585 self._ptr = <nvmlVgpuSchedulerStateInfo_v1_t *>calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v1_t))
18586 if self._ptr == NULL:
18587 raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1")
18588 self._owner = None
18589 self._owned = True
18590 self._readonly = False
18592 def __dealloc__(self):
18593 cdef nvmlVgpuSchedulerStateInfo_v1_t *ptr
18594 if self._owned and self._ptr != NULL:
18595 ptr = self._ptr
18596 self._ptr = NULL
18597 free(ptr)
18599 def __repr__(self):
18600 return f"<{__name__}.VgpuSchedulerStateInfo_v1 object at {hex(id(self))}>"
18602 @property
18603 def ptr(self):
18604 """Get the pointer address to the data as Python :class:`int`."""
18605 return <intptr_t>(self._ptr)
18607 cdef intptr_t _get_ptr(self):
18608 return <intptr_t>(self._ptr)
18610 def __int__(self):
18611 return <intptr_t>(self._ptr)
18613 def __eq__(self, other):
18614 cdef VgpuSchedulerStateInfo_v1 other_
18615 if not isinstance(other, VgpuSchedulerStateInfo_v1):
18616 return False
18617 other_ = other
18618 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) == 0)
18620 def __setitem__(self, key, val):
18621 if key == 0 and isinstance(val, _numpy.ndarray):
18622 self._ptr = <nvmlVgpuSchedulerStateInfo_v1_t *>malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t))
18623 if self._ptr == NULL:
18624 raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1")
18625 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v1_t))
18626 self._owner = None
18627 self._owned = True
18628 self._readonly = not val.flags.writeable
18629 else:
18630 setattr(self, key, val)
18632 @property
18633 def scheduler_params(self):
18634 """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters."""
18635 return VgpuSchedulerParams.from_ptr(<intptr_t>&(self._ptr[0].schedulerParams), self._readonly, self)
18637 @scheduler_params.setter
18638 def scheduler_params(self, val):
18639 if self._readonly:
18640 raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only")
18641 cdef VgpuSchedulerParams val_ = val
18642 memcpy(<void *>&(self._ptr[0].schedulerParams), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1)
18644 @property
18645 def version(self):
18646 """int: IN: The version number of this struct."""
18647 return self._ptr[0].version
18649 @version.setter
18650 def version(self, val):
18651 if self._readonly:
18652 raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only")
18653 self._ptr[0].version = val
18655 @property
18656 def engine_id(self):
18657 """int: IN: Engine whose software scheduler state info is fetched. One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*."""
18658 return self._ptr[0].engineId
18660 @engine_id.setter
18661 def engine_id(self, val):
18662 if self._readonly:
18663 raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only")
18664 self._ptr[0].engineId = val
18666 @property
18667 def scheduler_policy(self):
18668 """int: OUT: Scheduler policy."""
18669 return self._ptr[0].schedulerPolicy
18671 @scheduler_policy.setter
18672 def scheduler_policy(self, val):
18673 if self._readonly:
18674 raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only")
18675 self._ptr[0].schedulerPolicy = val
18677 @property
18678 def arr_mode(self):
18679 """int: OUT: Adaptive Round Robin scheduler mode. One of the NVML_VGPU_SCHEDULER_ARR_*."""
18680 return self._ptr[0].arrMode
18682 @arr_mode.setter
18683 def arr_mode(self, val):
18684 if self._readonly:
18685 raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only")
18686 self._ptr[0].arrMode = val
18688 @staticmethod
18689 def from_data(data):
18690 """Create an VgpuSchedulerStateInfo_v1 instance wrapping the given NumPy array.
18692 Args:
18693 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_info_v1_dtype` holding the data.
18694 """
18695 return __from_data(data, "vgpu_scheduler_state_info_v1_dtype", vgpu_scheduler_state_info_v1_dtype, VgpuSchedulerStateInfo_v1)
18697 @staticmethod
18698 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
18699 """Create an VgpuSchedulerStateInfo_v1 instance wrapping the given pointer.
18701 Args:
18702 ptr (intptr_t): pointer address as Python :class:`int` to the data.
18703 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
18704 readonly (bool): whether the data is read-only (to the user). default is `False`.
18705 """
18706 if ptr == 0:
18707 raise ValueError("ptr must not be null (0)")
18708 cdef VgpuSchedulerStateInfo_v1 obj = VgpuSchedulerStateInfo_v1.__new__(VgpuSchedulerStateInfo_v1)
18709 if owner is None:
18710 obj._ptr = <nvmlVgpuSchedulerStateInfo_v1_t *>malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t))
18711 if obj._ptr == NULL:
18712 raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1")
18713 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t))
18714 obj._owner = None
18715 obj._owned = True
18716 else:
18717 obj._ptr = <nvmlVgpuSchedulerStateInfo_v1_t *>ptr
18718 obj._owner = owner
18719 obj._owned = False
18720 obj._readonly = readonly
18721 return obj
18724cdef _get_vgpu_scheduler_log_info_v1_dtype_offsets():
18725 cdef nvmlVgpuSchedulerLogInfo_v1_t pod = nvmlVgpuSchedulerLogInfo_v1_t()
18726 return _numpy.dtype({
18727 'names': ['version', 'engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params', 'entries_count', 'log_entries'],
18728 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype, _numpy.uint32, (vgpu_scheduler_log_entry_dtype, 200)],
18729 'offsets': [
18730 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
18731 (<intptr_t>&(pod.engineId)) - (<intptr_t>&pod),
18732 (<intptr_t>&(pod.schedulerPolicy)) - (<intptr_t>&pod),
18733 (<intptr_t>&(pod.arrMode)) - (<intptr_t>&pod),
18734 (<intptr_t>&(pod.schedulerParams)) - (<intptr_t>&pod),
18735 (<intptr_t>&(pod.entriesCount)) - (<intptr_t>&pod),
18736 (<intptr_t>&(pod.logEntries)) - (<intptr_t>&pod),
18737 ],
18738 'itemsize': sizeof(nvmlVgpuSchedulerLogInfo_v1_t),
18739 })
18741vgpu_scheduler_log_info_v1_dtype = _get_vgpu_scheduler_log_info_v1_dtype_offsets()
18743cdef class VgpuSchedulerLogInfo_v1:
18744 """Empty-initialize an instance of `nvmlVgpuSchedulerLogInfo_v1_t`.
18747 .. seealso:: `nvmlVgpuSchedulerLogInfo_v1_t`
18748 """
18749 cdef:
18750 nvmlVgpuSchedulerLogInfo_v1_t *_ptr
18751 object _owner
18752 bint _owned
18753 bint _readonly
18755 def __init__(self):
18756 self._ptr = <nvmlVgpuSchedulerLogInfo_v1_t *>calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v1_t))
18757 if self._ptr == NULL:
18758 raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1")
18759 self._owner = None
18760 self._owned = True
18761 self._readonly = False
18763 def __dealloc__(self):
18764 cdef nvmlVgpuSchedulerLogInfo_v1_t *ptr
18765 if self._owned and self._ptr != NULL:
18766 ptr = self._ptr
18767 self._ptr = NULL
18768 free(ptr)
18770 def __repr__(self):
18771 return f"<{__name__}.VgpuSchedulerLogInfo_v1 object at {hex(id(self))}>"
18773 @property
18774 def ptr(self):
18775 """Get the pointer address to the data as Python :class:`int`."""
18776 return <intptr_t>(self._ptr)
18778 cdef intptr_t _get_ptr(self):
18779 return <intptr_t>(self._ptr)
18781 def __int__(self):
18782 return <intptr_t>(self._ptr)
18784 def __eq__(self, other):
18785 cdef VgpuSchedulerLogInfo_v1 other_
18786 if not isinstance(other, VgpuSchedulerLogInfo_v1):
18787 return False
18788 other_ = other
18789 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) == 0)
18791 def __setitem__(self, key, val):
18792 if key == 0 and isinstance(val, _numpy.ndarray):
18793 self._ptr = <nvmlVgpuSchedulerLogInfo_v1_t *>malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t))
18794 if self._ptr == NULL:
18795 raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1")
18796 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v1_t))
18797 self._owner = None
18798 self._owned = True
18799 self._readonly = not val.flags.writeable
18800 else:
18801 setattr(self, key, val)
18803 @property
18804 def scheduler_params(self):
18805 """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters."""
18806 return VgpuSchedulerParams.from_ptr(<intptr_t>&(self._ptr[0].schedulerParams), self._readonly, self)
18808 @scheduler_params.setter
18809 def scheduler_params(self, val):
18810 if self._readonly:
18811 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18812 cdef VgpuSchedulerParams val_ = val
18813 memcpy(<void *>&(self._ptr[0].schedulerParams), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1)
18815 @property
18816 def log_entries(self):
18817 """VgpuSchedulerLogEntry: OUT: Structure to store the state and logs of a software runlist."""
18818 return VgpuSchedulerLogEntry.from_ptr(<intptr_t>&(self._ptr[0].logEntries), 200, self._readonly)
18820 @log_entries.setter
18821 def log_entries(self, val):
18822 if self._readonly:
18823 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18824 cdef VgpuSchedulerLogEntry val_ = val
18825 if len(val) != 200:
18826 raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}")
18827 memcpy(<void *>&(self._ptr[0].logEntries), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_t) * 200)
18829 @property
18830 def version(self):
18831 """int: IN: The version number of this struct."""
18832 return self._ptr[0].version
18834 @version.setter
18835 def version(self, val):
18836 if self._readonly:
18837 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18838 self._ptr[0].version = val
18840 @property
18841 def engine_id(self):
18842 """int: IN: Engine whose software runlist log entries are fetched. One of One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*."""
18843 return self._ptr[0].engineId
18845 @engine_id.setter
18846 def engine_id(self, val):
18847 if self._readonly:
18848 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18849 self._ptr[0].engineId = val
18851 @property
18852 def scheduler_policy(self):
18853 """int: OUT: Scheduler policy."""
18854 return self._ptr[0].schedulerPolicy
18856 @scheduler_policy.setter
18857 def scheduler_policy(self, val):
18858 if self._readonly:
18859 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18860 self._ptr[0].schedulerPolicy = val
18862 @property
18863 def arr_mode(self):
18864 """int: OUT: Adaptive Round Robin scheduler mode. One of the NVML_VGPU_SCHEDULER_ARR_*."""
18865 return self._ptr[0].arrMode
18867 @arr_mode.setter
18868 def arr_mode(self, val):
18869 if self._readonly:
18870 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18871 self._ptr[0].arrMode = val
18873 @property
18874 def entries_count(self):
18875 """int: OUT: Count of log entries fetched."""
18876 return self._ptr[0].entriesCount
18878 @entries_count.setter
18879 def entries_count(self, val):
18880 if self._readonly:
18881 raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only")
18882 self._ptr[0].entriesCount = val
18884 @staticmethod
18885 def from_data(data):
18886 """Create an VgpuSchedulerLogInfo_v1 instance wrapping the given NumPy array.
18888 Args:
18889 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_info_v1_dtype` holding the data.
18890 """
18891 return __from_data(data, "vgpu_scheduler_log_info_v1_dtype", vgpu_scheduler_log_info_v1_dtype, VgpuSchedulerLogInfo_v1)
18893 @staticmethod
18894 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
18895 """Create an VgpuSchedulerLogInfo_v1 instance wrapping the given pointer.
18897 Args:
18898 ptr (intptr_t): pointer address as Python :class:`int` to the data.
18899 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
18900 readonly (bool): whether the data is read-only (to the user). default is `False`.
18901 """
18902 if ptr == 0:
18903 raise ValueError("ptr must not be null (0)")
18904 cdef VgpuSchedulerLogInfo_v1 obj = VgpuSchedulerLogInfo_v1.__new__(VgpuSchedulerLogInfo_v1)
18905 if owner is None:
18906 obj._ptr = <nvmlVgpuSchedulerLogInfo_v1_t *>malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t))
18907 if obj._ptr == NULL:
18908 raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1")
18909 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t))
18910 obj._owner = None
18911 obj._owned = True
18912 else:
18913 obj._ptr = <nvmlVgpuSchedulerLogInfo_v1_t *>ptr
18914 obj._owner = owner
18915 obj._owned = False
18916 obj._readonly = readonly
18917 return obj
18920cdef _get_vgpu_scheduler_state_v1_dtype_offsets():
18921 cdef nvmlVgpuSchedulerState_v1_t pod = nvmlVgpuSchedulerState_v1_t()
18922 return _numpy.dtype({
18923 'names': ['version', 'engine_id', 'scheduler_policy', 'enable_arr_mode', 'scheduler_params'],
18924 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_set_params_dtype],
18925 'offsets': [
18926 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
18927 (<intptr_t>&(pod.engineId)) - (<intptr_t>&pod),
18928 (<intptr_t>&(pod.schedulerPolicy)) - (<intptr_t>&pod),
18929 (<intptr_t>&(pod.enableARRMode)) - (<intptr_t>&pod),
18930 (<intptr_t>&(pod.schedulerParams)) - (<intptr_t>&pod),
18931 ],
18932 'itemsize': sizeof(nvmlVgpuSchedulerState_v1_t),
18933 })
18935vgpu_scheduler_state_v1_dtype = _get_vgpu_scheduler_state_v1_dtype_offsets()
18937cdef class VgpuSchedulerState_v1:
18938 """Empty-initialize an instance of `nvmlVgpuSchedulerState_v1_t`.
18941 .. seealso:: `nvmlVgpuSchedulerState_v1_t`
18942 """
18943 cdef:
18944 nvmlVgpuSchedulerState_v1_t *_ptr
18945 object _owner
18946 bint _owned
18947 bint _readonly
18949 def __init__(self):
18950 self._ptr = <nvmlVgpuSchedulerState_v1_t *>calloc(1, sizeof(nvmlVgpuSchedulerState_v1_t))
18951 if self._ptr == NULL:
18952 raise MemoryError("Error allocating VgpuSchedulerState_v1")
18953 self._owner = None
18954 self._owned = True
18955 self._readonly = False
18957 def __dealloc__(self):
18958 cdef nvmlVgpuSchedulerState_v1_t *ptr
18959 if self._owned and self._ptr != NULL:
18960 ptr = self._ptr
18961 self._ptr = NULL
18962 free(ptr)
18964 def __repr__(self):
18965 return f"<{__name__}.VgpuSchedulerState_v1 object at {hex(id(self))}>"
18967 @property
18968 def ptr(self):
18969 """Get the pointer address to the data as Python :class:`int`."""
18970 return <intptr_t>(self._ptr)
18972 cdef intptr_t _get_ptr(self):
18973 return <intptr_t>(self._ptr)
18975 def __int__(self):
18976 return <intptr_t>(self._ptr)
18978 def __eq__(self, other):
18979 cdef VgpuSchedulerState_v1 other_
18980 if not isinstance(other, VgpuSchedulerState_v1):
18981 return False
18982 other_ = other
18983 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlVgpuSchedulerState_v1_t)) == 0)
18985 def __setitem__(self, key, val):
18986 if key == 0 and isinstance(val, _numpy.ndarray):
18987 self._ptr = <nvmlVgpuSchedulerState_v1_t *>malloc(sizeof(nvmlVgpuSchedulerState_v1_t))
18988 if self._ptr == NULL:
18989 raise MemoryError("Error allocating VgpuSchedulerState_v1")
18990 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v1_t))
18991 self._owner = None
18992 self._owned = True
18993 self._readonly = not val.flags.writeable
18994 else:
18995 setattr(self, key, val)
18997 @property
18998 def scheduler_params(self):
18999 """VgpuSchedulerSetParams: IN: vGPU Scheduler Parameters."""
19000 return VgpuSchedulerSetParams.from_ptr(<intptr_t>&(self._ptr[0].schedulerParams), self._readonly, self)
19002 @scheduler_params.setter
19003 def scheduler_params(self, val):
19004 if self._readonly:
19005 raise ValueError("This VgpuSchedulerState_v1 instance is read-only")
19006 cdef VgpuSchedulerSetParams val_ = val
19007 memcpy(<void *>&(self._ptr[0].schedulerParams), <void *>(val_._get_ptr()), sizeof(nvmlVgpuSchedulerSetParams_t) * 1)
19009 @property
19010 def version(self):
19011 """int: IN: The version number of this struct."""
19012 return self._ptr[0].version
19014 @version.setter
19015 def version(self, val):
19016 if self._readonly:
19017 raise ValueError("This VgpuSchedulerState_v1 instance is read-only")
19018 self._ptr[0].version = val
19020 @property
19021 def engine_id(self):
19022 """int: IN: One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*."""
19023 return self._ptr[0].engineId
19025 @engine_id.setter
19026 def engine_id(self, val):
19027 if self._readonly:
19028 raise ValueError("This VgpuSchedulerState_v1 instance is read-only")
19029 self._ptr[0].engineId = val
19031 @property
19032 def scheduler_policy(self):
19033 """int: IN: Scheduler policy."""
19034 return self._ptr[0].schedulerPolicy
19036 @scheduler_policy.setter
19037 def scheduler_policy(self, val):
19038 if self._readonly:
19039 raise ValueError("This VgpuSchedulerState_v1 instance is read-only")
19040 self._ptr[0].schedulerPolicy = val
19042 @property
19043 def enable_arr_mode(self):
19044 """int: IN: Adaptive Round Robin scheduler."""
19045 return self._ptr[0].enableARRMode
19047 @enable_arr_mode.setter
19048 def enable_arr_mode(self, val):
19049 if self._readonly:
19050 raise ValueError("This VgpuSchedulerState_v1 instance is read-only")
19051 self._ptr[0].enableARRMode = val
19053 @staticmethod
19054 def from_data(data):
19055 """Create an VgpuSchedulerState_v1 instance wrapping the given NumPy array.
19057 Args:
19058 data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_v1_dtype` holding the data.
19059 """
19060 return __from_data(data, "vgpu_scheduler_state_v1_dtype", vgpu_scheduler_state_v1_dtype, VgpuSchedulerState_v1)
19062 @staticmethod
19063 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
19064 """Create an VgpuSchedulerState_v1 instance wrapping the given pointer.
19066 Args:
19067 ptr (intptr_t): pointer address as Python :class:`int` to the data.
19068 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
19069 readonly (bool): whether the data is read-only (to the user). default is `False`.
19070 """
19071 if ptr == 0:
19072 raise ValueError("ptr must not be null (0)")
19073 cdef VgpuSchedulerState_v1 obj = VgpuSchedulerState_v1.__new__(VgpuSchedulerState_v1)
19074 if owner is None:
19075 obj._ptr = <nvmlVgpuSchedulerState_v1_t *>malloc(sizeof(nvmlVgpuSchedulerState_v1_t))
19076 if obj._ptr == NULL:
19077 raise MemoryError("Error allocating VgpuSchedulerState_v1")
19078 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlVgpuSchedulerState_v1_t))
19079 obj._owner = None
19080 obj._owned = True
19081 else:
19082 obj._ptr = <nvmlVgpuSchedulerState_v1_t *>ptr
19083 obj._owner = owner
19084 obj._owned = False
19085 obj._readonly = readonly
19086 return obj
19089cdef _get_grid_licensable_features_dtype_offsets():
19090 cdef nvmlGridLicensableFeatures_t pod = nvmlGridLicensableFeatures_t()
19091 return _numpy.dtype({
19092 'names': ['is_grid_license_supported', 'licensable_features_count', 'grid_licensable_features'],
19093 'formats': [_numpy.int32, _numpy.uint32, (grid_licensable_feature_dtype, 3)],
19094 'offsets': [
19095 (<intptr_t>&(pod.isGridLicenseSupported)) - (<intptr_t>&pod),
19096 (<intptr_t>&(pod.licensableFeaturesCount)) - (<intptr_t>&pod),
19097 (<intptr_t>&(pod.gridLicensableFeatures)) - (<intptr_t>&pod),
19098 ],
19099 'itemsize': sizeof(nvmlGridLicensableFeatures_t),
19100 })
19102grid_licensable_features_dtype = _get_grid_licensable_features_dtype_offsets()
19104cdef class GridLicensableFeatures:
19105 """Empty-initialize an instance of `nvmlGridLicensableFeatures_t`.
19108 .. seealso:: `nvmlGridLicensableFeatures_t`
19109 """
19110 cdef:
19111 nvmlGridLicensableFeatures_t *_ptr
19112 object _owner
19113 bint _owned
19114 bint _readonly
19116 def __init__(self):
19117 self._ptr = <nvmlGridLicensableFeatures_t *>calloc(1, sizeof(nvmlGridLicensableFeatures_t)) 1x
19118 if self._ptr == NULL: 1x
19119 raise MemoryError("Error allocating GridLicensableFeatures")
19120 self._owner = None 1x
19121 self._owned = True 1x
19122 self._readonly = False 1x
19124 def __dealloc__(self):
19125 cdef nvmlGridLicensableFeatures_t *ptr
19126 if self._owned and self._ptr != NULL: 1x
19127 ptr = self._ptr 1x
19128 self._ptr = NULL 1x
19129 free(ptr) 1x
19131 def __repr__(self):
19132 return f"<{__name__}.GridLicensableFeatures object at {hex(id(self))}>"
19134 @property
19135 def ptr(self):
19136 """Get the pointer address to the data as Python :class:`int`."""
19137 return <intptr_t>(self._ptr)
19139 cdef intptr_t _get_ptr(self):
19140 return <intptr_t>(self._ptr) 1x
19142 def __int__(self):
19143 return <intptr_t>(self._ptr)
19145 def __eq__(self, other):
19146 cdef GridLicensableFeatures other_
19147 if not isinstance(other, GridLicensableFeatures):
19148 return False
19149 other_ = other
19150 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlGridLicensableFeatures_t)) == 0)
19152 def __setitem__(self, key, val):
19153 if key == 0 and isinstance(val, _numpy.ndarray):
19154 self._ptr = <nvmlGridLicensableFeatures_t *>malloc(sizeof(nvmlGridLicensableFeatures_t))
19155 if self._ptr == NULL:
19156 raise MemoryError("Error allocating GridLicensableFeatures")
19157 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlGridLicensableFeatures_t))
19158 self._owner = None
19159 self._owned = True
19160 self._readonly = not val.flags.writeable
19161 else:
19162 setattr(self, key, val)
19164 @property
19165 def grid_licensable_features(self):
19166 """GridLicensableFeature: """
19167 return GridLicensableFeature.from_ptr(<intptr_t>&(self._ptr[0].gridLicensableFeatures), self._ptr[0].licensableFeaturesCount, self._readonly) 1x
19169 @grid_licensable_features.setter
19170 def grid_licensable_features(self, val):
19171 if self._readonly:
19172 raise ValueError("This GridLicensableFeatures instance is read-only")
19173 cdef GridLicensableFeature val_ = val
19174 if len(val) > 3:
19175 raise ValueError(f"Expected length < 3 for field grid_licensable_features, got {len(val)}")
19176 self._ptr[0].licensableFeaturesCount = len(val)
19177 if len(val) == 0:
19178 return
19179 memcpy(<void *>&(self._ptr[0].gridLicensableFeatures), <void *>(val_._get_ptr()), sizeof(nvmlGridLicensableFeature_t) * self._ptr[0].licensableFeaturesCount)
19181 @property
19182 def is_grid_license_supported(self):
19183 """int: """
19184 return self._ptr[0].isGridLicenseSupported
19186 @is_grid_license_supported.setter
19187 def is_grid_license_supported(self, val):
19188 if self._readonly:
19189 raise ValueError("This GridLicensableFeatures instance is read-only")
19190 self._ptr[0].isGridLicenseSupported = val
19192 @staticmethod
19193 def from_data(data):
19194 """Create an GridLicensableFeatures instance wrapping the given NumPy array.
19196 Args:
19197 data (_numpy.ndarray): a single-element array of dtype `grid_licensable_features_dtype` holding the data.
19198 """
19199 return __from_data(data, "grid_licensable_features_dtype", grid_licensable_features_dtype, GridLicensableFeatures)
19201 @staticmethod
19202 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
19203 """Create an GridLicensableFeatures instance wrapping the given pointer.
19205 Args:
19206 ptr (intptr_t): pointer address as Python :class:`int` to the data.
19207 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
19208 readonly (bool): whether the data is read-only (to the user). default is `False`.
19209 """
19210 if ptr == 0:
19211 raise ValueError("ptr must not be null (0)")
19212 cdef GridLicensableFeatures obj = GridLicensableFeatures.__new__(GridLicensableFeatures)
19213 if owner is None:
19214 obj._ptr = <nvmlGridLicensableFeatures_t *>malloc(sizeof(nvmlGridLicensableFeatures_t))
19215 if obj._ptr == NULL:
19216 raise MemoryError("Error allocating GridLicensableFeatures")
19217 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlGridLicensableFeatures_t))
19218 obj._owner = None
19219 obj._owned = True
19220 else:
19221 obj._ptr = <nvmlGridLicensableFeatures_t *>ptr
19222 obj._owner = owner
19223 obj._owned = False
19224 obj._readonly = readonly
19225 return obj
19228cdef _get_nv_link_info_v2_dtype_offsets():
19229 cdef nvmlNvLinkInfo_v2_t pod = nvmlNvLinkInfo_v2_t()
19230 return _numpy.dtype({
19231 'names': ['version', 'is_nvle_enabled', 'firmware_info'],
19232 'formats': [_numpy.uint32, _numpy.uint32, nvlink_firmware_info_dtype],
19233 'offsets': [
19234 (<intptr_t>&(pod.version)) - (<intptr_t>&pod),
19235 (<intptr_t>&(pod.isNvleEnabled)) - (<intptr_t>&pod),
19236 (<intptr_t>&(pod.firmwareInfo)) - (<intptr_t>&pod),
19237 ],
19238 'itemsize': sizeof(nvmlNvLinkInfo_v2_t),
19239 })
19241nv_link_info_v2_dtype = _get_nv_link_info_v2_dtype_offsets()
19243cdef class NvLinkInfo_v2:
19244 """Empty-initialize an instance of `nvmlNvLinkInfo_v2_t`.
19247 .. seealso:: `nvmlNvLinkInfo_v2_t`
19248 """
19249 cdef:
19250 nvmlNvLinkInfo_v2_t *_ptr
19251 object _owner
19252 bint _owned
19253 bint _readonly
19255 def __init__(self):
19256 self._ptr = <nvmlNvLinkInfo_v2_t *>calloc(1, sizeof(nvmlNvLinkInfo_v2_t))
19257 if self._ptr == NULL:
19258 raise MemoryError("Error allocating NvLinkInfo_v2")
19259 self._owner = None
19260 self._owned = True
19261 self._readonly = False
19263 def __dealloc__(self):
19264 cdef nvmlNvLinkInfo_v2_t *ptr
19265 if self._owned and self._ptr != NULL:
19266 ptr = self._ptr
19267 self._ptr = NULL
19268 free(ptr)
19270 def __repr__(self):
19271 return f"<{__name__}.NvLinkInfo_v2 object at {hex(id(self))}>"
19273 @property
19274 def ptr(self):
19275 """Get the pointer address to the data as Python :class:`int`."""
19276 return <intptr_t>(self._ptr)
19278 cdef intptr_t _get_ptr(self):
19279 return <intptr_t>(self._ptr)
19281 def __int__(self):
19282 return <intptr_t>(self._ptr)
19284 def __eq__(self, other):
19285 cdef NvLinkInfo_v2 other_
19286 if not isinstance(other, NvLinkInfo_v2):
19287 return False
19288 other_ = other
19289 return (memcmp(<void *><intptr_t>(self._ptr), <void *><intptr_t>(other_._ptr), sizeof(nvmlNvLinkInfo_v2_t)) == 0)
19291 def __setitem__(self, key, val):
19292 if key == 0 and isinstance(val, _numpy.ndarray):
19293 self._ptr = <nvmlNvLinkInfo_v2_t *>malloc(sizeof(nvmlNvLinkInfo_v2_t))
19294 if self._ptr == NULL:
19295 raise MemoryError("Error allocating NvLinkInfo_v2")
19296 memcpy(<void*>self._ptr, <void*><intptr_t>val.ctypes.data, sizeof(nvmlNvLinkInfo_v2_t))
19297 self._owner = None
19298 self._owned = True
19299 self._readonly = not val.flags.writeable
19300 else:
19301 setattr(self, key, val)
19303 @property
19304 def firmware_info(self):
19305 """NvlinkFirmwareInfo: OUT - NVLINK Firmware info."""
19306 return NvlinkFirmwareInfo.from_ptr(<intptr_t>&(self._ptr[0].firmwareInfo), self._readonly, self)
19308 @firmware_info.setter
19309 def firmware_info(self, val):
19310 if self._readonly:
19311 raise ValueError("This NvLinkInfo_v2 instance is read-only")
19312 cdef NvlinkFirmwareInfo val_ = val
19313 memcpy(<void *>&(self._ptr[0].firmwareInfo), <void *>(val_._get_ptr()), sizeof(nvmlNvlinkFirmwareInfo_t) * 1)
19315 @property
19316 def version(self):
19317 """int: IN - the API version number."""
19318 return self._ptr[0].version
19320 @version.setter
19321 def version(self, val):
19322 if self._readonly:
19323 raise ValueError("This NvLinkInfo_v2 instance is read-only")
19324 self._ptr[0].version = val
19326 @property
19327 def is_nvle_enabled(self):
19328 """int: OUT - NVLINK encryption enablement."""
19329 return self._ptr[0].isNvleEnabled
19331 @is_nvle_enabled.setter
19332 def is_nvle_enabled(self, val):
19333 if self._readonly:
19334 raise ValueError("This NvLinkInfo_v2 instance is read-only")
19335 self._ptr[0].isNvleEnabled = val
19337 @staticmethod
19338 def from_data(data):
19339 """Create an NvLinkInfo_v2 instance wrapping the given NumPy array.
19341 Args:
19342 data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v2_dtype` holding the data.
19343 """
19344 return __from_data(data, "nv_link_info_v2_dtype", nv_link_info_v2_dtype, NvLinkInfo_v2)
19346 @staticmethod
19347 def from_ptr(intptr_t ptr, bint readonly=False, object owner=None):
19348 """Create an NvLinkInfo_v2 instance wrapping the given pointer.
19350 Args:
19351 ptr (intptr_t): pointer address as Python :class:`int` to the data.
19352 owner (object): The Python object that owns the pointer. If not provided, data will be copied.
19353 readonly (bool): whether the data is read-only (to the user). default is `False`.
19354 """
19355 if ptr == 0:
19356 raise ValueError("ptr must not be null (0)")
19357 cdef NvLinkInfo_v2 obj = NvLinkInfo_v2.__new__(NvLinkInfo_v2)
19358 if owner is None:
19359 obj._ptr = <nvmlNvLinkInfo_v2_t *>malloc(sizeof(nvmlNvLinkInfo_v2_t))
19360 if obj._ptr == NULL:
19361 raise MemoryError("Error allocating NvLinkInfo_v2")
19362 memcpy(<void*>(obj._ptr), <void*>ptr, sizeof(nvmlNvLinkInfo_v2_t))
19363 obj._owner = None
19364 obj._owned = True
19365 else:
19366 obj._ptr = <nvmlNvLinkInfo_v2_t *>ptr
19367 obj._owner = owner
19368 obj._owned = False
19369 obj._readonly = readonly
19370 return obj
19374cpdef init_v2():
19375 """Initialize NVML, but don't initialize any GPUs yet.
19377 .. seealso:: `nvmlInit_v2`
19378 """
19379 with nogil: 2a pbq qbrbsbtbubvbwbxbybzbAbBbCbDbEbFbDcGbe HcX HbIbJbKbLb9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblb$c'c)c+cUbVb
19380 __status__ = nvmlInit_v2() 2a pbq qbrbsbtbubvbwbxbybzbAbBbCbDbEbFbDcGbe HcX HbIbJbKbLb9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblb$c'c)c+cUbVb
19381 check_status(__status__) 2a pbq qbrbsbtbubvbwbxbybzbAbBbCbDbEbFbDcGbe HcX HbIbJbKbLb9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblb$c'c)c+cUbVb
19384cpdef init_with_flags(unsigned int flags):
19385 """nvmlInitWithFlags is a variant of nvmlInit(), that allows passing a set of boolean values modifying the behaviour of nvmlInit(). Other than the "flags" parameter it is completely similar to ``nvmlInit_v2``.
19387 Args:
19388 flags (unsigned int): behaviour modifier flags.
19390 .. seealso:: `nvmlInitWithFlags`
19391 """
19392 with nogil:
19393 __status__ = nvmlInitWithFlags(flags)
19394 check_status(__status__)
19397cpdef shutdown():
19398 """Shut down NVML by releasing all GPU resources previously allocated with :func:`init_v2`.
19400 .. seealso:: `nvmlShutdown`
19401 """
19402 with nogil: 2a mcq ncocpcqcrcsctcucvcwcxcyczcAcBcCcEcFce GcIcX JcKcLcMcNcOcPcQcSbRcScTcUcVcWcXcYcZc0c1c2c3c4c5c6c7c8c9c!c#c%c(c*c,c
19403 __status__ = nvmlShutdown() 2a mcq ncocpcqcrcsctcucvcwcxcyczcAcBcCcEcFce GcIcX JcKcLcMcNcOcPcQcSbRcScTcUcVcWcXcYcZc0c1c2c3c4c5c6c7c8c9c!c#c%c(c*c,c
19404 check_status(__status__) 2a mcq ncocpcqcrcsctcucvcwcxcyczcAcBcCcEcFce GcIcX JcKcLcMcNcOcPcQcSbRcScTcUcVcWcXcYcZc0c1c2c3c4c5c6c7c8c9c!c#c%c(c*c,c
19407cpdef str error_string(int result):
19408 """Helper method for converting NVML error codes into readable strings.
19410 Args:
19411 result (Return): NVML error code to convert.
19413 .. seealso:: `nvmlErrorString`
19414 """
19415 cdef bytes _output_
19416 _output_ = nvmlErrorString(<_Return>result) 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
19417 return _output_.decode() 1WHpIJVNCzXK8swOPQRSTiAjbkgBhnl
19420cpdef str system_get_driver_version():
19421 """Retrieves the version of the system's graphics driver.
19423 .. seealso:: `nvmlSystemGetDriverVersion`
19424 """
19425 cdef unsigned int length = 80 2Zb2b
19426 cdef char[80] version
19427 with nogil: 2Zb2b
19428 __status__ = nvmlSystemGetDriverVersion(version, length) 2Zb2b
19429 check_status(__status__) 2Zb2b
19430 return cpython.PyUnicode_FromString(version) 2Zb2b
19433cpdef str system_get_nvml_version():
19434 """Retrieves the version of the NVML library.
19436 .. seealso:: `nvmlSystemGetNVMLVersion`
19437 """
19438 cdef unsigned int length = 80 20b3b
19439 cdef char[80] version
19440 with nogil: 20b3b
19441 __status__ = nvmlSystemGetNVMLVersion(version, length) 20b3b
19442 check_status(__status__) 20b3b
19443 return cpython.PyUnicode_FromString(version) 20b3b
19446cpdef int system_get_cuda_driver_version() except *:
19447 """Retrieves the version of the CUDA driver.
19449 Returns:
19450 int: Reference in which to return the version identifier.
19452 .. seealso:: `nvmlSystemGetCudaDriverVersion`
19453 """
19454 cdef int cuda_driver_version
19455 with nogil: 2a 8b'b)b
19456 __status__ = nvmlSystemGetCudaDriverVersion(&cuda_driver_version) 2a 8b'b)b
19457 check_status(__status__) 2a 8b'b)b
19458 return cuda_driver_version 2a 8b'b)b
19461cpdef int system_get_cuda_driver_version_v2() except 0:
19462 """Retrieves the version of the CUDA driver from the shared library.
19464 Returns:
19465 int: Reference in which to return the version identifier.
19467 .. seealso:: `nvmlSystemGetCudaDriverVersion_v2`
19468 """
19469 cdef int cuda_driver_version
19470 with nogil:
19471 __status__ = nvmlSystemGetCudaDriverVersion_v2(&cuda_driver_version)
19472 check_status(__status__)
19473 return cuda_driver_version
19476cpdef str system_get_process_name(unsigned int pid):
19477 """Gets name of the process with provided process id.
19479 Args:
19480 pid (unsigned int): The identifier of the process.
19482 .. seealso:: `nvmlSystemGetProcessName`
19483 """
19484 cdef unsigned int length = 1024 2Yb1b
19485 cdef char[1024] name
19486 with nogil: 2Yb1b
19487 __status__ = nvmlSystemGetProcessName(pid, name, length) 2Yb1b
19488 check_status(__status__) 2Yb1b
19489 return cpython.PyUnicode_FromString(name) 2Yb1b
19492cpdef object system_get_hic_version():
19493 """Retrieves the IDs and firmware versions for any Host Interface Cards (HICs) in the system.
19495 .. seealso:: `nvmlSystemGetHicVersion`
19496 """
19497 cdef unsigned int[1] hwbc_count = [0]
19498 with nogil:
19499 __status__ = nvmlSystemGetHicVersion(<unsigned int*>hwbc_count, NULL)
19500 check_status_size(__status__)
19501 cdef HwbcEntry hwbc_entries = HwbcEntry(hwbc_count[0])
19502 cdef nvmlHwbcEntry_t *hwbc_entries_ptr = <nvmlHwbcEntry_t *><intptr_t>(hwbc_entries._get_ptr())
19503 if hwbc_count[0] == 0:
19504 return hwbc_entries
19505 with nogil:
19506 __status__ = nvmlSystemGetHicVersion(<unsigned int*>hwbc_count, hwbc_entries_ptr)
19507 check_status(__status__)
19508 return hwbc_entries
19511cpdef unsigned int unit_get_count() except? 0:
19512 """Retrieves the number of units in the system.
19514 Returns:
19515 unsigned int: Reference in which to return the number of units.
19517 .. seealso:: `nvmlUnitGetCount`
19518 """
19519 cdef unsigned int unit_count
19520 with nogil:
19521 __status__ = nvmlUnitGetCount(&unit_count)
19522 check_status(__status__)
19523 return unit_count
19526cpdef intptr_t unit_get_handle_by_index(unsigned int ind_ex) except? 0:
19527 """Acquire the handle for a particular unit, based on its ind_ex.
19529 Args:
19530 ind_ex (unsigned int): The ind_ex of the target unit, >= 0 and < ``unitCount``.
19532 Returns:
19533 intptr_t: Reference in which to return the unit handle.
19535 .. seealso:: `nvmlUnitGetHandleByIndex`
19536 """
19537 cdef Unit unit
19538 with nogil:
19539 __status__ = nvmlUnitGetHandleByIndex(ind_ex, &unit)
19540 check_status(__status__)
19541 return <intptr_t>unit
19544cpdef object unit_get_unit_info(intptr_t unit):
19545 """Retrieves the static information associated with a unit.
19547 Args:
19548 unit (intptr_t): The identifier of the target unit.
19550 Returns:
19551 nvmlUnitInfo_t: Reference in which to return the unit information.
19553 .. seealso:: `nvmlUnitGetUnitInfo`
19554 """
19555 cdef UnitInfo info_py = UnitInfo()
19556 cdef nvmlUnitInfo_t *info = <nvmlUnitInfo_t *><intptr_t>(info_py._get_ptr())
19557 with nogil:
19558 __status__ = nvmlUnitGetUnitInfo(<Unit>unit, info)
19559 check_status(__status__)
19560 return info_py
19563cpdef object unit_get_led_state(intptr_t unit):
19564 """Retrieves the LED state associated with this unit.
19566 Args:
19567 unit (intptr_t): The identifier of the target unit.
19569 Returns:
19570 nvmlLedState_t: Reference in which to return the current LED state.
19572 .. seealso:: `nvmlUnitGetLedState`
19573 """
19574 cdef LedState state_py = LedState()
19575 cdef nvmlLedState_t *state = <nvmlLedState_t *><intptr_t>(state_py._get_ptr())
19576 with nogil:
19577 __status__ = nvmlUnitGetLedState(<Unit>unit, state)
19578 check_status(__status__)
19579 return state_py
19582cpdef object unit_get_psu_info(intptr_t unit):
19583 """Retrieves the PSU stats for the unit.
19585 Args:
19586 unit (intptr_t): The identifier of the target unit.
19588 Returns:
19589 nvmlPSUInfo_t: Reference in which to return the PSU information.
19591 .. seealso:: `nvmlUnitGetPsuInfo`
19592 """
19593 cdef PSUInfo psu_py = PSUInfo()
19594 cdef nvmlPSUInfo_t *psu = <nvmlPSUInfo_t *><intptr_t>(psu_py._get_ptr())
19595 with nogil:
19596 __status__ = nvmlUnitGetPsuInfo(<Unit>unit, psu)
19597 check_status(__status__)
19598 return psu_py
19601cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0:
19602 """Retrieves the temperature readings for the unit, in degrees C.
19604 Args:
19605 unit (intptr_t): The identifier of the target unit.
19606 type (unsigned int): The type of reading to take.
19608 Returns:
19609 unsigned int: Reference in which to return the intake temperature.
19611 .. seealso:: `nvmlUnitGetTemperature`
19612 """
19613 cdef unsigned int temp
19614 with nogil:
19615 __status__ = nvmlUnitGetTemperature(<Unit>unit, type, &temp)
19616 check_status(__status__)
19617 return temp
19620cpdef object unit_get_fan_speed_info(intptr_t unit):
19621 """Retrieves the fan speed readings for the unit.
19623 Args:
19624 unit (intptr_t): The identifier of the target unit.
19626 Returns:
19627 nvmlUnitFanSpeeds_t: Reference in which to return the fan speed information.
19629 .. seealso:: `nvmlUnitGetFanSpeedInfo`
19630 """
19631 cdef UnitFanSpeeds fan_speeds_py = UnitFanSpeeds()
19632 cdef nvmlUnitFanSpeeds_t *fan_speeds = <nvmlUnitFanSpeeds_t *><intptr_t>(fan_speeds_py._get_ptr())
19633 with nogil:
19634 __status__ = nvmlUnitGetFanSpeedInfo(<Unit>unit, fan_speeds)
19635 check_status(__status__)
19636 return fan_speeds_py
19639cpdef unsigned int device_get_count_v2() except? 0:
19640 """Retrieves the number of compute devices in the system. A compute device is a single GPU.
19642 Returns:
19643 unsigned int: Reference in which to return the number of accessible devices.
19645 .. seealso:: `nvmlDeviceGetCount_v2`
19646 """
19647 cdef unsigned int device_count
19648 with nogil: 24b5b6bq G e ' X 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * 9bZ + !br $ #bm c 1 % , 5 - d g . 6 $b%b/ 7 B ! f h t n u Ub(b*bVb+b,b-b.b/b:b;b=b?b@b[b]b^b_b`b{b|b}b~bacbcccdcecfcgchcicjckclc
19649 __status__ = nvmlDeviceGetCount_v2(&device_count) 24b5b6bq G e ' X 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * 9bZ + !br $ #bm c 1 % , 5 - d g . 6 $b%b/ 7 B ! f h t n u Ub(b*bVb+b,b-b.b/b:b;b=b?b@b[b]b^b_b`b{b|b}b~bacbcccdcecfcgchcicjckclc
19650 check_status(__status__) 24b5b6bq G e ' X 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * 9bZ + !br $ #bm c 1 % , 5 - d g . 6 $b%b/ 7 B ! f h t n u Ub(b*bVb+b,b-b.b/b:b;b=b?b@b[b]b^b_b`b{b|b}b~bacbcccdcecfcgchcicjckclc
19651 return device_count 24b5b6bq G e ' X 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * 9bZ + !br $ #bm c 1 % , 5 - d g . 6 $b%b/ 7 B ! f h t n u Ub(b*bVb+b,b-b.b/b:b;b=b?b@b[b]b^b_b`b{b|b}b~bacbcccdcecfcgchcicjckclc
19654cpdef object device_get_attributes_v2(intptr_t device):
19655 """Get attributes (engine counts etc.) for the given NVML device handle.
19657 Args:
19658 device (intptr_t): NVML device handle.
19660 Returns:
19661 nvmlDeviceAttributes_t: Device attributes.
19663 .. seealso:: `nvmlDeviceGetAttributes_v2`
19664 """
19665 cdef DeviceAttributes attributes_py = DeviceAttributes() 1k
19666 cdef nvmlDeviceAttributes_t *attributes = <nvmlDeviceAttributes_t *><intptr_t>(attributes_py._get_ptr()) 1k
19667 with nogil: 1k
19668 __status__ = nvmlDeviceGetAttributes_v2(<Device>device, attributes) 1k
19669 check_status(__status__) 1k
19670 return attributes_py
19673cpdef intptr_t device_get_handle_by_index_v2(unsigned int ind_ex) except? 0:
19674 """Acquire the handle for a particular device, based on its ind_ex.
19676 Args:
19677 ind_ex (unsigned int): The ind_ex of the target GPU, >= 0 and < ``accessibleDevices``.
19679 Returns:
19680 intptr_t: Reference in which to return the device handle.
19682 .. seealso:: `nvmlDeviceGetHandleByIndex_v2`
19683 """
19684 cdef Device device
19685 with nogil: 2q G e ' 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * Z + r $ m c 1 % , 5 - d g . 6 / 7 B ! f h t n u
19686 __status__ = nvmlDeviceGetHandleByIndex_v2(ind_ex, &device) 2q G e ' 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * Z + r $ m c 1 % , 5 - d g . 6 / 7 B ! f h t n u
19687 check_status(__status__) 2q G e ' 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * Z + r $ m c 1 % , 5 - d g . 6 / 7 B ! f h t n u
19688 return <intptr_t>device 2q G e ' 9 ; ? L 4 [ ^ _ ` { | } ~ abbbcbdbebfbgbhbibjbkblbi E A j Y b ( ) k y * Z + r $ m c 1 % , 5 - d g . 6 / 7 B ! f h t n u
19691cpdef intptr_t device_get_handle_by_serial(serial) except? 0:
19692 """Acquire the handle for a particular device, based on its board serial number.
19694 Args:
19695 serial (str): The board serial number of the target GPU.
19697 Returns:
19698 intptr_t: Reference in which to return the device handle.
19700 .. seealso:: `nvmlDeviceGetHandleBySerial`
19701 """
19702 if not isinstance(serial, str):
19703 raise TypeError("serial must be a Python str")
19704 cdef bytes _temp_serial_ = (<str>serial).encode()
19705 cdef char* _serial_ = _temp_serial_
19706 cdef Device device
19707 with nogil:
19708 __status__ = nvmlDeviceGetHandleBySerial(<const char*>_serial_, &device)
19709 check_status(__status__)
19710 return <intptr_t>device
19713cpdef intptr_t device_get_handle_by_uuid(uuid) except? 0:
19714 """Acquire the handle for a particular device, based on its globally unique immutable UUID (in ASCII format) associated with each device.
19716 Args:
19717 uuid (str): The UUID of the target GPU or MIG instance.
19719 Returns:
19720 intptr_t: Reference in which to return the device handle or MIG device handle.
19722 .. seealso:: `nvmlDeviceGetHandleByUUID`
19723 """
19724 if not isinstance(uuid, str): 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19725 raise TypeError("uuid must be a Python str")
19726 cdef bytes _temp_uuid_ = (<str>uuid).encode() 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19727 cdef char* _uuid_ = _temp_uuid_ 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19728 cdef Device device
19729 with nogil: 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19730 __status__ = nvmlDeviceGetHandleByUUID(<const char*>_uuid_, &device) 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19731 check_status(__status__) 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19732 return <intptr_t>device 2pbqbrbsbtbubvbwbxbybzbAbBbCbDbEbFbGbe HbIbJbKbLbTbv
19735cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0:
19736 """Acquire the handle for a particular device, based on its PCI bus id.
19738 Args:
19739 pci_bus_id (str): The PCI bus id of the target GPU Accept the following formats (all numbers in hexadecimal): domain:bus:device.function in format x:x:x.x domain:bus:device in format x:x:x bus:device.function in format x:x.x.
19741 Returns:
19742 intptr_t: Reference in which to return the device handle.
19744 .. seealso:: `nvmlDeviceGetHandleByPciBusId_v2`
19745 """
19746 if not isinstance(pci_bus_id, str): 2Nbm
19747 raise TypeError("pci_bus_id must be a Python str")
19748 cdef bytes _temp_pci_bus_id_ = (<str>pci_bus_id).encode() 2Nbm
19749 cdef char* _pci_bus_id_ = _temp_pci_bus_id_ 2Nbm
19750 cdef Device device
19751 with nogil: 2Nbm
19752 __status__ = nvmlDeviceGetHandleByPciBusId_v2(<const char*>_pci_bus_id_, &device) 2Nbm
19753 check_status(__status__) 2Nbm
19754 return <intptr_t>device 2Nbm
19757cpdef str device_get_name(intptr_t device):
19758 """Retrieves the name of this device.
19760 Args:
19761 device (intptr_t): The identifier of the target device.
19763 .. seealso:: `nvmlDeviceGetName`
19764 """
19765 cdef unsigned int length = 96 1qHpINesOPQRSTiAjbk$Bn
19766 cdef char[96] name
19767 with nogil: 1qHpINesOPQRSTiAjbk$Bn
19768 __status__ = nvmlDeviceGetName(<Device>device, name, length) 1qHpINesOPQRSTiAjbk$Bn
19769 check_status(__status__) 1qHpINesOPQRSTiAjbk$Bn
19770 return cpython.PyUnicode_FromString(name) 1qHpINesOPQRSTiAjbk$Bn
19773cpdef int device_get_brand(intptr_t device) except? -1:
19774 """Retrieves the brand of this device.
19776 Args:
19777 device (intptr_t): The identifier of the target device.
19779 Returns:
19780 int: Reference in which to return the product brand type.
19782 .. seealso:: `nvmlDeviceGetBrand`
19783 """
19784 cdef _BrandType type
19785 with nogil: 1*
19786 __status__ = nvmlDeviceGetBrand(<Device>device, &type) 1*
19787 check_status(__status__) 1*
19788 return <int>type 1*
19791cpdef unsigned int device_get_index(intptr_t device) except? 0:
19792 """Retrieves the NVML index of this device.
19794 Args:
19795 device (intptr_t): The identifier of the target device.
19797 Returns:
19798 unsigned int: Reference in which to return the NVML index of the device.
19800 .. seealso:: `nvmlDeviceGetIndex`
19801 """
19802 cdef unsigned int ind_ex
19803 with nogil: 1'm/
19804 __status__ = nvmlDeviceGetIndex(<Device>device, &ind_ex) 1'm/
19805 check_status(__status__) 1'm/
19806 return ind_ex 1'm/
19809cpdef str device_get_serial(intptr_t device):
19810 """Retrieves the globally unique board serial number associated with this device's board.
19812 Args:
19813 device (intptr_t): The identifier of the target device.
19815 .. seealso:: `nvmlDeviceGetSerial`
19816 """
19817 cdef unsigned int length = 30 1e1
19818 cdef char[30] serial
19819 with nogil: 1e1
19820 __status__ = nvmlDeviceGetSerial(<Device>device, serial, length) 1e1
19821 check_status(__status__) 1e1
19822 return cpython.PyUnicode_FromString(serial) 1e1
19825cpdef unsigned int device_get_module_id(intptr_t device) except? 0:
19826 """Get a unique identifier for the device module on the baseboard.
19828 Args:
19829 device (intptr_t): The identifier of the target device.
19831 Returns:
19832 unsigned int: Unique identifier for the GPU module.
19834 .. seealso:: `nvmlDeviceGetModuleId`
19835 """
19836 cdef unsigned int module_id
19837 with nogil: 1G7
19838 __status__ = nvmlDeviceGetModuleId(<Device>device, &module_id) 1G7
19839 check_status(__status__) 1G7
19840 return module_id 1G7
19843cpdef object device_get_c2c_mode_info_v(intptr_t device):
19844 """Retrieves the Device's C2C Mode information.
19846 Args:
19847 device (intptr_t): The identifier of the target device.
19849 Returns:
19850 nvmlC2cModeInfo_v1_t: Output struct containing the device's C2C Mode info.
19852 .. seealso:: `nvmlDeviceGetC2cModeInfoV`
19853 """
19854 cdef C2cModeInfo_v1 c2c_mode_info_py = C2cModeInfo_v1() 1j
19855 cdef nvmlC2cModeInfo_v1_t *c2c_mode_info = <nvmlC2cModeInfo_v1_t *><intptr_t>(c2c_mode_info_py._get_ptr()) 1j
19856 with nogil: 1j
19857 __status__ = nvmlDeviceGetC2cModeInfoV(<Device>device, c2c_mode_info) 1j
19858 check_status(__status__) 1j
19859 return c2c_mode_info_py
19862cpdef object device_get_memory_affinity(intptr_t device, unsigned int node_set_size, unsigned int scope):
19863 """Retrieves an array of unsigned ints (sized to node_set_size) of bitmasks with the ideal memory affinity within node or socket for the device. For example, if NUMA node 0, 1 are ideal within the socket for the device and node_set_size == 1, result[0] = 0x3.
19865 Args:
19866 device (intptr_t): The identifier of the target device.
19867 node_set_size (unsigned int): The size of the nodeSet array that is safe to access.
19868 scope (unsigned int): Array reference in which to return a bitmask of NODEs, 64 NODEs per unsigned long on 64-bit machines, 32 on 32-bit machines.
19870 .. seealso:: `nvmlDeviceGetMemoryAffinity`
19871 """
19872 if node_set_size == 0: 1@]E
19873 return view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0]
19874 cdef view.array node_set = view.array(shape=(node_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") 1@]E
19875 cdef unsigned long *node_set_ptr = <unsigned long *>(node_set.data) 1@]E
19876 with nogil: 1@]E
19877 __status__ = nvmlDeviceGetMemoryAffinity(<Device>device, node_set_size, node_set_ptr, <nvmlAffinityScope_t>scope) 1@]E
19878 check_status(__status__) 1@]E
19879 return node_set 1@]E
19882cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int cpu_set_size, unsigned int scope):
19883 """Retrieves an array of unsigned ints (sized to cpu_set_size) of bitmasks with the ideal CPU affinity within node or socket for the device. For example, if processors 0, 1, 32, and 33 are ideal for the device and cpu_set_size == 2, result[0] = 0x3, result[1] = 0x3.
19885 Args:
19886 device (intptr_t): The identifier of the target device.
19887 cpu_set_size (unsigned int): The size of the cpuSet array that is safe to access.
19888 scope (unsigned int): Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines.
19890 .. seealso:: `nvmlDeviceGetCpuAffinityWithinScope`
19891 """
19892 if cpu_set_size == 0: 1:=EZM
19893 return view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0]
19894 cdef view.array cpu_set = view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") 1:=EZM
19895 cdef unsigned long *cpu_set_ptr = <unsigned long *>(cpu_set.data) 1:=EZM
19896 with nogil: 1:=EZM
19897 __status__ = nvmlDeviceGetCpuAffinityWithinScope(<Device>device, cpu_set_size, cpu_set_ptr, <nvmlAffinityScope_t>scope) 1:=EZM
19898 check_status(__status__) 1:=EZM
19899 return cpu_set 1:=EZM
19902cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size):
19903 """Retrieves an array of unsigned ints (sized to cpu_set_size) of bitmasks with the ideal CPU affinity for the device For example, if processors 0, 1, 32, and 33 are ideal for the device and cpu_set_size == 2, result[0] = 0x3, result[1] = 0x3 This is equivalent to calling ``nvmlDeviceGetCpuAffinityWithinScope`` with ``NVML_AFFINITY_SCOPE_NODE``.
19905 Args:
19906 device (intptr_t): The identifier of the target device.
19907 cpu_set_size (unsigned int): The size of the cpuSet array that is safe to access.
19909 .. seealso:: `nvmlDeviceGetCpuAffinity`
19910 """
19911 if cpu_set_size == 0:
19912 return view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0]
19913 cdef view.array cpu_set = view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c")
19914 cdef unsigned long *cpu_set_ptr = <unsigned long *>(cpu_set.data)
19915 with nogil:
19916 __status__ = nvmlDeviceGetCpuAffinity(<Device>device, cpu_set_size, cpu_set_ptr)
19917 check_status(__status__)
19918 return cpu_set
19921cpdef device_set_cpu_affinity(intptr_t device):
19922 """Sets the ideal affinity for the calling thread and device using the guidelines given in :func:`device_get_cpu_affinity`. Note, this is a change as of version 8.0. Older versions set the affinity for a calling process and all children. Currently supports up to 1024 processors.
19924 Args:
19925 device (intptr_t): The identifier of the target device.
19927 .. seealso:: `nvmlDeviceSetCpuAffinity`
19928 """
19929 with nogil:
19930 __status__ = nvmlDeviceSetCpuAffinity(<Device>device)
19931 check_status(__status__)
19934cpdef device_clear_cpu_affinity(intptr_t device):
19935 """Clear all affinity bindings for the calling thread. Note, this is a change as of version 8.0 as older versions cleared the affinity for a calling process and all children.
19937 Args:
19938 device (intptr_t): The identifier of the target device.
19940 .. seealso:: `nvmlDeviceClearCpuAffinity`
19941 """
19942 with nogil:
19943 __status__ = nvmlDeviceClearCpuAffinity(<Device>device)
19944 check_status(__status__)
19947cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0:
19948 """Get the NUMA node of the given GPU device. This only applies to platforms where the GPUs are NUMA nodes.
19950 Args:
19951 device (intptr_t): The device handle.
19953 Returns:
19954 unsigned int: NUMA node ID of the device.
19956 .. seealso:: `nvmlDeviceGetNumaNodeId`
19957 """
19958 cdef unsigned int node
19959 with nogil: 1B
19960 __status__ = nvmlDeviceGetNumaNodeId(<Device>device, &node) 1B
19961 check_status(__status__) 1B
19962 return node
19965cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1:
19966 """Retrieve the common ancestor for two devices For all products. Supported on Linux only.
19968 Args:
19969 device1 (intptr_t): The identifier of the first device.
19970 device2 (intptr_t): The identifier of the second device.
19972 Returns:
19973 int: A ``nvmlGpuTopologyLevel_t`` that gives the path type.
19975 .. seealso:: `nvmlDeviceGetTopologyCommonAncestor`
19976 """
19977 cdef _GpuTopologyLevel path_info
19978 with nogil:
19979 __status__ = nvmlDeviceGetTopologyCommonAncestor(<Device>device1, <Device>device2, &path_info)
19980 check_status(__status__)
19981 return <int>path_info
19984cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_ind_ex) except? -1:
19985 """Retrieve the status for a given p2p capability index between a given pair of GPU.
19987 Args:
19988 device1 (intptr_t): The first device.
19989 device2 (intptr_t): The second device.
19990 p2p_ind_ex (GpuP2PCapsIndex): p2p Capability Index being looked for between ``device1`` and ``device2``.
19992 Returns:
19993 int: Reference in which to return the status of the ``p2p_ind_ex`` between ``device1`` and ``device2``.
19995 .. seealso:: `nvmlDeviceGetP2PStatus`
19996 """
19997 cdef _GpuP2PStatus p2p_status
19998 with nogil:
19999 __status__ = nvmlDeviceGetP2PStatus(<Device>device1, <Device>device2, <_GpuP2PCapsIndex>p2p_ind_ex, &p2p_status)
20000 check_status(__status__)
20001 return <int>p2p_status
20004cpdef str device_get_uuid(intptr_t device):
20005 """Retrieves the globally unique immutable UUID associated with this device, as a 5 part hexadecimal string, that augments the immutable, board serial identifier.
20007 Args:
20008 device (intptr_t): The identifier of the target device.
20010 .. seealso:: `nvmlDeviceGetUUID`
20011 """
20012 cdef unsigned int length = 96 10Ge4%uv
20013 cdef char[96] uuid
20014 with nogil: 10Ge4%uv
20015 __status__ = nvmlDeviceGetUUID(<Device>device, uuid, length) 10Ge4%uv
20016 check_status(__status__) 10Ge4%uv
20017 return cpython.PyUnicode_FromString(uuid) 10Ge4%uv
20020cpdef unsigned int device_get_minor_number(intptr_t device) except? 0:
20021 """Retrieves minor number for the device. The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number].
20023 Args:
20024 device (intptr_t): The identifier of the target device.
20026 Returns:
20027 unsigned int: Reference in which to return the minor number for the device.
20029 .. seealso:: `nvmlDeviceGetMinorNumber`
20030 """
20031 cdef unsigned int minor_number
20032 with nogil: 1.
20033 __status__ = nvmlDeviceGetMinorNumber(<Device>device, &minor_number) 1.
20034 check_status(__status__) 1.
20035 return minor_number 1.
20038cpdef str device_get_board_part_number(intptr_t device):
20039 """Retrieves the the device board part number which is programmed into the board's InfoROM.
20041 Args:
20042 device (intptr_t): Identifier of the target device.
20044 .. seealso:: `nvmlDeviceGetBoardPartNumber`
20045 """
20046 cdef unsigned int length = 80 1g
20047 cdef char[80] part_number
20048 with nogil: 1g
20049 __status__ = nvmlDeviceGetBoardPartNumber(<Device>device, part_number, length) 1g
20050 check_status(__status__) 1g
20051 return cpython.PyUnicode_FromString(part_number) 1g
20054cpdef str device_get_inforom_version(intptr_t device, int object):
20055 """Retrieves the version information for the device's infoROM object.
20057 Args:
20058 device (intptr_t): The identifier of the target device.
20059 object (InforomObject): The target infoROM object.
20061 .. seealso:: `nvmlDeviceGetInforomVersion`
20062 """
20063 cdef unsigned int length = 16 1g
20064 cdef char[16] version
20065 with nogil: 1g
20066 __status__ = nvmlDeviceGetInforomVersion(<Device>device, <_InforomObject>object, version, length) 1g
20067 check_status(__status__) 1g
20068 return cpython.PyUnicode_FromString(version) 1g
20071cpdef str device_get_inforom_image_version(intptr_t device):
20072 """Retrieves the global infoROM image version.
20074 Args:
20075 device (intptr_t): The identifier of the target device.
20077 .. seealso:: `nvmlDeviceGetInforomImageVersion`
20078 """
20079 cdef unsigned int length = 16 1g
20080 cdef char[16] version
20081 with nogil: 1g
20082 __status__ = nvmlDeviceGetInforomImageVersion(<Device>device, version, length) 1g
20083 check_status(__status__) 1g
20084 return cpython.PyUnicode_FromString(version) 1g
20087cpdef unsigned int device_get_inforom_configuration_checksum(intptr_t device) except? 0:
20088 """Retrieves the checksum of the configuration stored in the device's infoROM.
20090 Args:
20091 device (intptr_t): The identifier of the target device.
20093 Returns:
20094 unsigned int: Reference in which to return the infoROM configuration checksum.
20096 .. seealso:: `nvmlDeviceGetInforomConfigurationChecksum`
20097 """
20098 cdef unsigned int checksum
20099 with nogil: 1g
20100 __status__ = nvmlDeviceGetInforomConfigurationChecksum(<Device>device, &checksum) 1g
20101 check_status(__status__) 1g
20102 return checksum 1g
20105cpdef device_validate_inforom(intptr_t device):
20106 """Reads the infoROM from the flash and verifies the checksums.
20108 Args:
20109 device (intptr_t): The identifier of the target device.
20111 .. seealso:: `nvmlDeviceValidateInforom`
20112 """
20113 with nogil: 1g
20114 __status__ = nvmlDeviceValidateInforom(<Device>device) 1g
20115 check_status(__status__) 1g
20118cpdef tuple device_get_last_bbx_flush_time(intptr_t device):
20119 """Retrieves the timestamp and the duration of the last flush of the BBX (blackbox) infoROM object during the current run.
20121 Args:
20122 device (intptr_t): The identifier of the target device.
20124 Returns:
20125 A 2-tuple containing:
20127 - unsigned long long: The start timestamp of the last BBX Flush.
20128 - unsigned long: The duration (us) of the last BBX Flush.
20130 .. seealso:: `nvmlDeviceGetLastBBXFlushTime`
20131 """
20132 cdef unsigned long long timestamp
20133 cdef unsigned long duration_us
20134 with nogil: 1g
20135 __status__ = nvmlDeviceGetLastBBXFlushTime(<Device>device, ×tamp, &duration_us) 1g
20136 check_status(__status__) 1g
20137 return (timestamp, duration_us)
20140cpdef int device_get_display_mode(intptr_t device) except? -1:
20141 """Retrieves the display mode for the device.
20143 Args:
20144 device (intptr_t): The identifier of the target device.
20146 Returns:
20147 int: Reference in which to return the display mode.
20149 .. seealso:: `nvmlDeviceGetDisplayMode`
20150 """
20151 cdef _EnableState display
20152 with nogil: 15
20153 __status__ = nvmlDeviceGetDisplayMode(<Device>device, &display) 15
20154 check_status(__status__) 15
20155 return <int>display 15
20158cpdef int device_get_display_active(intptr_t device) except? -1:
20159 """Retrieves the display active state for the device.
20161 Args:
20162 device (intptr_t): The identifier of the target device.
20164 Returns:
20165 int: Reference in which to return the display active state.
20167 .. seealso:: `nvmlDeviceGetDisplayActive`
20168 """
20169 cdef _EnableState is_active
20170 with nogil: 15
20171 __status__ = nvmlDeviceGetDisplayActive(<Device>device, &is_active) 15
20172 check_status(__status__) 15
20173 return <int>is_active 15
20176cpdef int device_get_persistence_mode(intptr_t device) except? -1:
20177 """Retrieves the persistence mode associated with this device.
20179 Args:
20180 device (intptr_t): The identifier of the target device.
20182 Returns:
20183 int: Reference in which to return the current driver persistence mode.
20185 .. seealso:: `nvmlDeviceGetPersistenceMode`
20186 """
20187 cdef _EnableState mode
20188 with nogil: 1!
20189 __status__ = nvmlDeviceGetPersistenceMode(<Device>device, &mode) 1!
20190 check_status(__status__) 1!
20191 return <int>mode 1!
20194cpdef object device_get_pci_info_ext(intptr_t device):
20195 """Retrieves PCI attributes of this device.
20197 Args:
20198 device (intptr_t): The identifier of the target device.
20200 Returns:
20201 nvmlPciInfoExt_v1_t: Reference in which to return the PCI info.
20203 .. seealso:: `nvmlDeviceGetPciInfoExt`
20204 """
20205 cdef PciInfoExt_v1 pci_py = PciInfoExt_v1() 1mcuv
20206 cdef nvmlPciInfoExt_t *pci = <nvmlPciInfoExt_t *><intptr_t>(pci_py._get_ptr()) 1mcuv
20207 pci.version = NVML_VERSION_STRUCT(sizeof(nvmlPciInfoExt_v1_t), 1) 1mcuv
20208 with nogil: 1mcuv
20209 __status__ = nvmlDeviceGetPciInfoExt(<Device>device, pci) 1mcuv
20210 check_status(__status__) 1mcuv
20211 return pci_py 1mcuv
20214cpdef object device_get_pci_info_v3(intptr_t device):
20215 """Retrieves the PCI attributes of this device.
20217 Args:
20218 device (intptr_t): The identifier of the target device.
20220 Returns:
20221 nvmlPciInfo_t: Reference in which to return the PCI info.
20223 .. seealso:: `nvmlDeviceGetPciInfo_v3`
20224 """
20225 cdef PciInfo pci_py = PciInfo() 1qewL
20226 cdef nvmlPciInfo_t *pci = <nvmlPciInfo_t *><intptr_t>(pci_py._get_ptr()) 1qewL
20227 with nogil: 1qewL
20228 __status__ = nvmlDeviceGetPciInfo_v3(<Device>device, pci) 1qewL
20229 check_status(__status__) 1qewL
20230 return pci_py 1qewL
20233cpdef unsigned int device_get_max_pcie_link_generation(intptr_t device) except? 0:
20234 """Retrieves the maximum PCIe link generation possible with this device and system.
20236 Args:
20237 device (intptr_t): The identifier of the target device.
20239 Returns:
20240 unsigned int: Reference in which to return the max PCIe link generation.
20242 .. seealso:: `nvmlDeviceGetMaxPcieLinkGeneration`
20243 """
20244 cdef unsigned int max_link_gen
20245 with nogil: 1c
20246 __status__ = nvmlDeviceGetMaxPcieLinkGeneration(<Device>device, &max_link_gen) 1c
20247 check_status(__status__) 1c
20248 return max_link_gen 1c
20251cpdef unsigned int device_get_gpu_max_pcie_link_generation(intptr_t device) except? 0:
20252 """Retrieves the maximum PCIe link generation supported by this device.
20254 Args:
20255 device (intptr_t): The identifier of the target device.
20257 Returns:
20258 unsigned int: Reference in which to return the max PCIe link generation.
20260 .. seealso:: `nvmlDeviceGetGpuMaxPcieLinkGeneration`
20261 """
20262 cdef unsigned int max_link_gen_device
20263 with nogil: 1c
20264 __status__ = nvmlDeviceGetGpuMaxPcieLinkGeneration(<Device>device, &max_link_gen_device) 1c
20265 check_status(__status__) 1c
20266 return max_link_gen_device 1c
20269cpdef unsigned int device_get_max_pcie_link_width(intptr_t device) except? 0:
20270 """Retrieves the maximum PCIe link width possible with this device and system.
20272 Args:
20273 device (intptr_t): The identifier of the target device.
20275 Returns:
20276 unsigned int: Reference in which to return the max PCIe link generation.
20278 .. seealso:: `nvmlDeviceGetMaxPcieLinkWidth`
20279 """
20280 cdef unsigned int max_link_width
20281 with nogil: 1c
20282 __status__ = nvmlDeviceGetMaxPcieLinkWidth(<Device>device, &max_link_width) 1c
20283 check_status(__status__) 1c
20284 return max_link_width 1c
20287cpdef unsigned int device_get_curr_pcie_link_generation(intptr_t device) except? 0:
20288 """Retrieves the current PCIe link generation.
20290 Args:
20291 device (intptr_t): The identifier of the target device.
20293 Returns:
20294 unsigned int: Reference in which to return the current PCIe link generation.
20296 .. seealso:: `nvmlDeviceGetCurrPcieLinkGeneration`
20297 """
20298 cdef unsigned int curr_link_gen
20299 with nogil: 1c
20300 __status__ = nvmlDeviceGetCurrPcieLinkGeneration(<Device>device, &curr_link_gen) 1c
20301 check_status(__status__) 1c
20302 return curr_link_gen 1c
20305cpdef unsigned int device_get_curr_pcie_link_width(intptr_t device) except? 0:
20306 """Retrieves the current PCIe link width.
20308 Args:
20309 device (intptr_t): The identifier of the target device.
20311 Returns:
20312 unsigned int: Reference in which to return the current PCIe link generation.
20314 .. seealso:: `nvmlDeviceGetCurrPcieLinkWidth`
20315 """
20316 cdef unsigned int curr_link_width
20317 with nogil: 1c
20318 __status__ = nvmlDeviceGetCurrPcieLinkWidth(<Device>device, &curr_link_width) 1c
20319 check_status(__status__) 1c
20320 return curr_link_width 1c
20323cpdef unsigned int device_get_pcie_throughput(intptr_t device, int counter) except? 0:
20324 """Retrieve PCIe utilization information. This function is querying a byte counter over a 20ms interval and thus is the PCIe throughput over that interval.
20326 Args:
20327 device (intptr_t): The identifier of the target device.
20328 counter (PcieUtilCounter): The specific counter that should be queried ``nvmlPcieUtilCounter_t``.
20330 Returns:
20331 unsigned int: Reference in which to return throughput in KB/s.
20333 .. seealso:: `nvmlDeviceGetPcieThroughput`
20334 """
20335 cdef unsigned int value
20336 with nogil: 2Obc
20337 __status__ = nvmlDeviceGetPcieThroughput(<Device>device, <_PcieUtilCounter>counter, &value) 2Obc
20338 check_status(__status__) 2Obc
20339 return value 2Obc
20342cpdef unsigned int device_get_pcie_replay_counter(intptr_t device) except? 0:
20343 """Retrieve the PCIe replay counter.
20345 Args:
20346 device (intptr_t): The identifier of the target device.
20348 Returns:
20349 unsigned int: Reference in which to return the counter's value.
20351 .. seealso:: `nvmlDeviceGetPcieReplayCounter`
20352 """
20353 cdef unsigned int value
20354 with nogil: 1c
20355 __status__ = nvmlDeviceGetPcieReplayCounter(<Device>device, &value) 1c
20356 check_status(__status__) 1c
20357 return value 1c
20360cpdef unsigned int device_get_clock_info(intptr_t device, int type) except? 0:
20361 """Retrieves the current clock speeds for the device.
20363 Args:
20364 device (intptr_t): The identifier of the target device.
20365 type (ClockType): Identify which clock domain to query.
20367 Returns:
20368 unsigned int: Reference in which to return the clock speed in MHz.
20370 .. seealso:: `nvmlDeviceGetClockInfo`
20371 """
20372 cdef unsigned int clock
20373 with nogil:
20374 __status__ = nvmlDeviceGetClockInfo(<Device>device, <_ClockType>type, &clock)
20375 check_status(__status__)
20376 return clock
20379cpdef unsigned int device_get_max_clock_info(intptr_t device, int type) except? 0:
20380 """Retrieves the maximum clock speeds for the device.
20382 Args:
20383 device (intptr_t): The identifier of the target device.
20384 type (ClockType): Identify which clock domain to query.
20386 Returns:
20387 unsigned int: Reference in which to return the clock speed in MHz.
20389 .. seealso:: `nvmlDeviceGetMaxClockInfo`
20390 """
20391 cdef unsigned int clock
20392 with nogil: 1b
20393 __status__ = nvmlDeviceGetMaxClockInfo(<Device>device, <_ClockType>type, &clock) 1b
20394 check_status(__status__) 1b
20395 return clock 1b
20398cpdef int device_get_gpc_clk_vf_offset(intptr_t device) except? 0:
20399 """Retrieve the GPCCLK VF offset value.
20401 Args:
20402 device (intptr_t): The identifier of the target device.
20404 Returns:
20405 int: The retrieved GPCCLK VF offset value.
20407 .. seealso:: `nvmlDeviceGetGpcClkVfOffset`
20408 """
20409 cdef int offset
20410 with nogil:
20411 __status__ = nvmlDeviceGetGpcClkVfOffset(<Device>device, &offset)
20412 check_status(__status__)
20413 return offset
20416cpdef unsigned int device_get_clock(intptr_t device, int clock_type, int clock_id) except? 0:
20417 """Retrieves the clock speed for the clock specified by the clock type and clock ID.
20419 Args:
20420 device (intptr_t): The identifier of the target device.
20421 clock_type (ClockType): Identify which clock domain to query.
20422 clock_id (ClockId): Identify which clock in the domain to query.
20424 Returns:
20425 unsigned int: Reference in which to return the clock in MHz.
20427 .. seealso:: `nvmlDeviceGetClock`
20428 """
20429 cdef unsigned int clock_m_hz
20430 with nogil: 1b
20431 __status__ = nvmlDeviceGetClock(<Device>device, <_ClockType>clock_type, <_ClockId>clock_id, &clock_m_hz) 1b
20432 check_status(__status__) 1b
20433 return clock_m_hz 1b
20436cpdef unsigned int device_get_max_customer_boost_clock(intptr_t device, int clock_type) except? 0:
20437 """Retrieves the customer defined maximum boost clock speed specified by the given clock type.
20439 Args:
20440 device (intptr_t): The identifier of the target device.
20441 clock_type (ClockType): Identify which clock domain to query.
20443 Returns:
20444 unsigned int: Reference in which to return the clock in MHz.
20446 .. seealso:: `nvmlDeviceGetMaxCustomerBoostClock`
20447 """
20448 cdef unsigned int clock_m_hz
20449 with nogil: 1b
20450 __status__ = nvmlDeviceGetMaxCustomerBoostClock(<Device>device, <_ClockType>clock_type, &clock_m_hz) 1b
20451 check_status(__status__) 1b
20452 return clock_m_hz 1b
20455cpdef object device_get_supported_memory_clocks(intptr_t device):
20456 """Retrieves the list of possible memory clocks that can be used as an argument for ``nvmlDeviceSetMemoryLockedClocks``.
20458 Args:
20459 device (intptr_t): The identifier of the target device.
20461 .. seealso:: `nvmlDeviceGetSupportedMemoryClocks`
20462 """
20463 cdef unsigned int[1] count = [0]
20464 with nogil:
20465 __status__ = nvmlDeviceGetSupportedMemoryClocks(<Device>device, <unsigned int*>count, NULL)
20466 check_status_size(__status__)
20467 if count[0] == 0:
20468 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
20469 cdef view.array clocks_m_hz = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
20470 cdef unsigned int *clocks_m_hz_ptr = <unsigned int *>(clocks_m_hz.data)
20471 with nogil:
20472 __status__ = nvmlDeviceGetSupportedMemoryClocks(<Device>device, <unsigned int*>count, clocks_m_hz_ptr)
20473 check_status(__status__)
20474 return clocks_m_hz
20477cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int memory_clock_m_hz):
20478 """Retrieves the list of possible graphics clocks that can be used as an argument for ``nvmlDeviceSetGpuLockedClocks``.
20480 Args:
20481 device (intptr_t): The identifier of the target device.
20482 memory_clock_m_hz (unsigned int): Memory clock for which to return possible graphics clocks.
20484 .. seealso:: `nvmlDeviceGetSupportedGraphicsClocks`
20485 """
20486 cdef unsigned int[1] count = [0]
20487 with nogil:
20488 __status__ = nvmlDeviceGetSupportedGraphicsClocks(<Device>device, memory_clock_m_hz, <unsigned int*>count, NULL)
20489 check_status_size(__status__)
20490 if count[0] == 0:
20491 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
20492 cdef view.array clocks_m_hz = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
20493 cdef unsigned int *clocks_m_hz_ptr = <unsigned int *>(clocks_m_hz.data)
20494 with nogil:
20495 __status__ = nvmlDeviceGetSupportedGraphicsClocks(<Device>device, memory_clock_m_hz, <unsigned int*>count, clocks_m_hz_ptr)
20496 check_status(__status__)
20497 return clocks_m_hz
20500cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device):
20501 """Retrieve the current state of Auto Boosted clocks on a device and store it in ``isEnabled``.
20503 Args:
20504 device (intptr_t): The identifier of the target device.
20506 Returns:
20507 A 2-tuple containing:
20509 - int: Where to store the current state of Auto Boosted clocks of the target device.
20510 - int: Where to store the default Auto Boosted clocks behavior of the target device that the device will revert to when no applications are using the GPU.
20512 .. seealso:: `nvmlDeviceGetAutoBoostedClocksEnabled`
20513 """
20514 cdef _EnableState is_enabled
20515 cdef _EnableState default_is_enabled
20516 with nogil: 1A
20517 __status__ = nvmlDeviceGetAutoBoostedClocksEnabled(<Device>device, &is_enabled, &default_is_enabled) 1A
20518 check_status(__status__) 1A
20519 return (<int>is_enabled, <int>default_is_enabled)
20522cpdef unsigned int device_get_fan_speed(intptr_t device) except? 0:
20523 """Retrieves the intended operating speed of the device's fan.
20525 Args:
20526 device (intptr_t): The identifier of the target device.
20528 Returns:
20529 unsigned int: Reference in which to return the fan speed percentage.
20531 .. seealso:: `nvmlDeviceGetFanSpeed`
20532 """
20533 cdef unsigned int speed
20534 with nogil:
20535 __status__ = nvmlDeviceGetFanSpeed(<Device>device, &speed)
20536 check_status(__status__)
20537 return speed
20540cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) except? 0:
20541 """Retrieves the intended operating speed of the device's specified fan.
20543 Args:
20544 device (intptr_t): The identifier of the target device.
20545 fan (unsigned int): The index of the target fan, zero indexed.
20547 Returns:
20548 unsigned int: Reference in which to return the fan speed percentage.
20550 .. seealso:: `nvmlDeviceGetFanSpeed_v2`
20551 """
20552 cdef unsigned int speed
20553 with nogil:
20554 __status__ = nvmlDeviceGetFanSpeed_v2(<Device>device, fan, &speed)
20555 check_status(__status__)
20556 return speed
20559cpdef unsigned int device_get_target_fan_speed(intptr_t device, unsigned int fan) except? 0:
20560 """Retrieves the intended target speed of the device's specified fan.
20562 Args:
20563 device (intptr_t): The identifier of the target device.
20564 fan (unsigned int): The index of the target fan, zero indexed.
20566 Returns:
20567 unsigned int: Reference in which to return the fan speed percentage.
20569 .. seealso:: `nvmlDeviceGetTargetFanSpeed`
20570 """
20571 cdef unsigned int target_speed
20572 with nogil:
20573 __status__ = nvmlDeviceGetTargetFanSpeed(<Device>device, fan, &target_speed)
20574 check_status(__status__)
20575 return target_speed
20578cpdef tuple device_get_min_max_fan_speed(intptr_t device):
20579 """Retrieves the min and max fan speed that user can set for the GPU fan.
20581 Args:
20582 device (intptr_t): The identifier of the target device.
20584 Returns:
20585 A 2-tuple containing:
20587 - unsigned int: The minimum speed allowed to set.
20588 - unsigned int: The maximum speed allowed to set.
20590 .. seealso:: `nvmlDeviceGetMinMaxFanSpeed`
20591 """
20592 cdef unsigned int min_speed
20593 cdef unsigned int max_speed
20594 with nogil:
20595 __status__ = nvmlDeviceGetMinMaxFanSpeed(<Device>device, &min_speed, &max_speed)
20596 check_status(__status__)
20597 return (min_speed, max_speed)
20600cpdef unsigned int device_get_fan_control_policy_v2(intptr_t device, unsigned int fan) except *:
20601 """Gets current fan control policy.
20603 Args:
20604 device (intptr_t): The identifier of the target ``device``.
20605 fan (unsigned int): The index of the target fan, zero indexed.
20607 Returns:
20608 unsigned int: Reference in which to return the fan control ``policy``.
20610 .. seealso:: `nvmlDeviceGetFanControlPolicy_v2`
20611 """
20612 cdef nvmlFanControlPolicy_t policy
20613 with nogil:
20614 __status__ = nvmlDeviceGetFanControlPolicy_v2(<Device>device, fan, &policy)
20615 check_status(__status__)
20616 return <unsigned int>policy
20619cpdef unsigned int device_get_num_fans(intptr_t device) except? 0:
20620 """Retrieves the number of fans on the device.
20622 Args:
20623 device (intptr_t): The identifier of the target device.
20625 Returns:
20626 unsigned int: The number of fans.
20628 .. seealso:: `nvmlDeviceGetNumFans`
20629 """
20630 cdef unsigned int num_fans
20631 with nogil: 1(-
20632 __status__ = nvmlDeviceGetNumFans(<Device>device, &num_fans) 1(-
20633 check_status(__status__) 1(-
20634 return num_fans 1(-
20637cpdef object device_get_cooler_info(intptr_t device):
20638 """Retrieves the cooler's information. Returns a cooler's control signal characteristics. The possible types are restricted, Variable and Toggle. See ``nvmlCoolerControl_t`` for details on available signal types. Returns objects that cooler cools. Targets may be GPU, Memory, Power Supply or All of these. See ``nvmlCoolerTarget_t`` for details on available targets.
20640 Args:
20641 device (intptr_t): The identifier of the target device.
20643 Returns:
20644 nvmlCoolerInfo_v1_t: Structure specifying the cooler's control signal characteristics (out) and the target that cooler cools (out).
20646 .. seealso:: `nvmlDeviceGetCoolerInfo`
20647 """
20648 cdef CoolerInfo_v1 cooler_info_py = CoolerInfo_v1()
20649 cdef nvmlCoolerInfo_t *cooler_info = <nvmlCoolerInfo_t *><intptr_t>(cooler_info_py._get_ptr())
20650 cooler_info.version = NVML_VERSION_STRUCT(sizeof(nvmlCoolerInfo_v1_t), 1)
20651 with nogil:
20652 __status__ = nvmlDeviceGetCoolerInfo(<Device>device, cooler_info)
20653 check_status(__status__)
20654 return cooler_info_py
20657cpdef unsigned int device_get_temperature_threshold(intptr_t device, int threshold_type) except? 0:
20658 """Retrieves the temperature threshold for the GPU with the specified threshold type in degrees C.
20660 Args:
20661 device (intptr_t): The identifier of the target device.
20662 threshold_type (TemperatureThresholds): The type of threshold value queried.
20664 Returns:
20665 unsigned int: Reference in which to return the temperature reading.
20667 .. seealso:: `nvmlDeviceGetTemperatureThreshold`
20668 """
20669 cdef unsigned int temp
20670 with nogil: 1Nn
20671 __status__ = nvmlDeviceGetTemperatureThreshold(<Device>device, <_TemperatureThresholds>threshold_type, &temp) 1Nn
20672 check_status(__status__) 1Nn
20673 return temp 1n
20676cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_ind_ex):
20677 """Used to execute a list of thermal system instructions.
20679 Args:
20680 device (intptr_t): The identifier of the target device.
20681 sensor_ind_ex (unsigned int): The index of the thermal sensor.
20683 Returns:
20684 nvmlGpuThermalSettings_t: Reference in which to return the thermal sensor information.
20686 .. seealso:: `nvmlDeviceGetThermalSettings`
20687 """
20688 cdef GpuThermalSettings p_thermal_settings_py = GpuThermalSettings()
20689 cdef nvmlGpuThermalSettings_t *p_thermal_settings = <nvmlGpuThermalSettings_t *><intptr_t>(p_thermal_settings_py._get_ptr())
20690 with nogil:
20691 __status__ = nvmlDeviceGetThermalSettings(<Device>device, sensor_ind_ex, p_thermal_settings)
20692 check_status(__status__)
20693 return p_thermal_settings_py
20696cpdef int device_get_performance_state(intptr_t device) except? -1:
20697 """Retrieves the current performance state for the device.
20699 Args:
20700 device (intptr_t): The identifier of the target device.
20702 Returns:
20703 int: Reference in which to return the performance state reading.
20705 .. seealso:: `nvmlDeviceGetPerformanceState`
20706 """
20707 cdef _Pstates p_state
20708 with nogil: 1bf
20709 __status__ = nvmlDeviceGetPerformanceState(<Device>device, &p_state) 1bf
20710 check_status(__status__) 1bf
20711 return <int>p_state 1bf
20714cpdef unsigned long long device_get_current_clocks_event_reasons(intptr_t device) except? 0:
20715 """Retrieves current clocks event reasons.
20717 Args:
20718 device (intptr_t): The identifier of the target device.
20720 Returns:
20721 unsigned long long: Reference in which to return bitmask of active clocks event reasons.
20723 .. seealso:: `nvmlDeviceGetCurrentClocksEventReasons`
20724 """
20725 cdef unsigned long long clocks_event_reasons
20726 with nogil: 1Y
20727 __status__ = nvmlDeviceGetCurrentClocksEventReasons(<Device>device, &clocks_event_reasons) 1Y
20728 check_status(__status__) 1Y
20729 return clocks_event_reasons 1Y
20732cpdef unsigned long long device_get_supported_clocks_event_reasons(intptr_t device) except? 0:
20733 """Retrieves bitmask of supported clocks event reasons that can be returned by ``nvmlDeviceGetCurrentClocksEventReasons``.
20735 Args:
20736 device (intptr_t): The identifier of the target device.
20738 Returns:
20739 unsigned long long: Reference in which to return bitmask of supported clocks event reasons.
20741 .. seealso:: `nvmlDeviceGetSupportedClocksEventReasons`
20742 """
20743 cdef unsigned long long supported_clocks_event_reasons
20744 with nogil: 1Y
20745 __status__ = nvmlDeviceGetSupportedClocksEventReasons(<Device>device, &supported_clocks_event_reasons) 1Y
20746 check_status(__status__) 1Y
20747 return supported_clocks_event_reasons 1Y
20750cpdef int device_get_power_state(intptr_t device) except? -1:
20751 """Deprecated: Use ``nvmlDeviceGetPerformanceState``. This function exposes an incorrect generalization.
20753 Args:
20754 device (intptr_t): The identifier of the target device.
20756 Returns:
20757 int: Reference in which to return the performance state reading.
20759 .. seealso:: `nvmlDeviceGetPowerState`
20760 """
20761 cdef _Pstates p_state
20762 with nogil:
20763 __status__ = nvmlDeviceGetPowerState(<Device>device, &p_state)
20764 check_status(__status__)
20765 return <int>p_state
20768cpdef object device_get_dynamic_pstates_info(intptr_t device):
20769 """Retrieve performance monitor samples from the associated subdevice.
20771 Args:
20772 device (intptr_t): .
20774 Returns:
20775 nvmlGpuDynamicPstatesInfo_t: .
20777 .. seealso:: `nvmlDeviceGetDynamicPstatesInfo`
20778 """
20779 cdef GpuDynamicPstatesInfo p_dynamic_pstates_info_py = GpuDynamicPstatesInfo() 1f
20780 cdef nvmlGpuDynamicPstatesInfo_t *p_dynamic_pstates_info = <nvmlGpuDynamicPstatesInfo_t *><intptr_t>(p_dynamic_pstates_info_py._get_ptr()) 1f
20781 with nogil: 1f
20782 __status__ = nvmlDeviceGetDynamicPstatesInfo(<Device>device, p_dynamic_pstates_info) 1f
20783 check_status(__status__) 1f
20784 return p_dynamic_pstates_info_py 1f
20787cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0:
20788 """Retrieve the MemClk (Memory Clock) VF offset value.
20790 Args:
20791 device (intptr_t): The identifier of the target device.
20793 Returns:
20794 int: The retrieved MemClk VF offset value.
20796 .. seealso:: `nvmlDeviceGetMemClkVfOffset`
20797 """
20798 cdef int offset
20799 with nogil:
20800 __status__ = nvmlDeviceGetMemClkVfOffset(<Device>device, &offset)
20801 check_status(__status__)
20802 return offset
20805cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int pstate):
20806 """Retrieve min and max clocks of some clock domain for a given PState.
20808 Args:
20809 device (intptr_t): The identifier of the target device.
20810 type (ClockType): Clock domain.
20811 pstate (Pstates): PState to query.
20813 Returns:
20814 A 2-tuple containing:
20816 - unsigned int: Reference in which to return min clock frequency.
20817 - unsigned int: Reference in which to return max clock frequency.
20819 .. seealso:: `nvmlDeviceGetMinMaxClockOfPState`
20820 """
20821 cdef unsigned int min_clock_m_hz
20822 cdef unsigned int max_clock_m_hz
20823 with nogil: 1b
20824 __status__ = nvmlDeviceGetMinMaxClockOfPState(<Device>device, <_ClockType>type, <_Pstates>pstate, &min_clock_m_hz, &max_clock_m_hz) 1b
20825 check_status(__status__) 1b
20826 return (min_clock_m_hz, max_clock_m_hz) 1b
20829cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device):
20830 """Retrieve the GPCCLK min max VF offset value.
20832 Args:
20833 device (intptr_t): The identifier of the target device.
20835 Returns:
20836 A 2-tuple containing:
20838 - int: The retrieved GPCCLK VF min offset value.
20839 - int: The retrieved GPCCLK VF max offset value.
20841 .. seealso:: `nvmlDeviceGetGpcClkMinMaxVfOffset`
20842 """
20843 cdef int min_offset
20844 cdef int max_offset
20845 with nogil:
20846 __status__ = nvmlDeviceGetGpcClkMinMaxVfOffset(<Device>device, &min_offset, &max_offset)
20847 check_status(__status__)
20848 return (min_offset, max_offset)
20851cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device):
20852 """Retrieve the MemClk (Memory Clock) min max VF offset value.
20854 Args:
20855 device (intptr_t): The identifier of the target device.
20857 Returns:
20858 A 2-tuple containing:
20860 - int: The retrieved MemClk VF min offset value.
20861 - int: The retrieved MemClk VF max offset value.
20863 .. seealso:: `nvmlDeviceGetMemClkMinMaxVfOffset`
20864 """
20865 cdef int min_offset
20866 cdef int max_offset
20867 with nogil:
20868 __status__ = nvmlDeviceGetMemClkMinMaxVfOffset(<Device>device, &min_offset, &max_offset)
20869 check_status(__status__)
20870 return (min_offset, max_offset)
20873cpdef device_set_clock_offsets(intptr_t device, intptr_t info):
20874 """Control current clock offset of some clock domain for a given PState.
20876 Args:
20877 device (intptr_t): The identifier of the target device.
20878 info (intptr_t): Structure specifying the clock type (input), the pstate (input) and clock offset value (input).
20880 .. seealso:: `nvmlDeviceSetClockOffsets`
20881 """
20882 with nogil:
20883 __status__ = nvmlDeviceSetClockOffsets(<Device>device, <nvmlClockOffset_t*>info)
20884 check_status(__status__)
20887cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0:
20888 """Retrieves the power management limit associated with this device.
20890 Args:
20891 device (intptr_t): The identifier of the target device.
20893 Returns:
20894 unsigned int: Reference in which to return the power management limit in milliwatts.
20896 .. seealso:: `nvmlDeviceGetPowerManagementLimit`
20897 """
20898 cdef unsigned int limit
20899 with nogil: 2Mb
20900 __status__ = nvmlDeviceGetPowerManagementLimit(<Device>device, &limit) 2Mb
20901 check_status(__status__) 2Mb
20902 return limit 2Mb
20905cpdef tuple device_get_power_management_limit_constraints(intptr_t device):
20906 """Retrieves information about possible values of power management limits on this device.
20908 Args:
20909 device (intptr_t): The identifier of the target device.
20911 Returns:
20912 A 2-tuple containing:
20914 - unsigned int: Reference in which to return the minimum power management limit in milliwatts.
20915 - unsigned int: Reference in which to return the maximum power management limit in milliwatts.
20917 .. seealso:: `nvmlDeviceGetPowerManagementLimitConstraints`
20918 """
20919 cdef unsigned int min_limit
20920 cdef unsigned int max_limit
20921 with nogil:
20922 __status__ = nvmlDeviceGetPowerManagementLimitConstraints(<Device>device, &min_limit, &max_limit)
20923 check_status(__status__)
20924 return (min_limit, max_limit)
20927cpdef unsigned int device_get_power_management_default_limit(intptr_t device) except? 0:
20928 """Retrieves default power management limit on this device, in milliwatts. Default power management limit is a power management limit that the device boots with.
20930 Args:
20931 device (intptr_t): The identifier of the target device.
20933 Returns:
20934 unsigned int: Reference in which to return the default power management limit in milliwatts.
20936 .. seealso:: `nvmlDeviceGetPowerManagementDefaultLimit`
20937 """
20938 cdef unsigned int default_limit
20939 with nogil:
20940 __status__ = nvmlDeviceGetPowerManagementDefaultLimit(<Device>device, &default_limit)
20941 check_status(__status__)
20942 return default_limit
20945cpdef unsigned int device_get_power_usage(intptr_t device) except? 0:
20946 """Retrieves power usage for this GPU in milliwatts and its associated circuitry (e.g. memory).
20948 Args:
20949 device (intptr_t): The identifier of the target device.
20951 Returns:
20952 unsigned int: Reference in which to return the power usage information.
20954 .. seealso:: `nvmlDeviceGetPowerUsage`
20955 """
20956 cdef unsigned int power
20957 with nogil: 2Pb
20958 __status__ = nvmlDeviceGetPowerUsage(<Device>device, &power) 2Pb
20959 check_status(__status__) 2Pb
20960 return power 2Pb
20963cpdef unsigned long long device_get_total_energy_consumption(intptr_t device) except? 0:
20964 """Retrieves total energy consumption for this GPU in millijoules (mJ) since the driver was last reloaded.
20966 Args:
20967 device (intptr_t): The identifier of the target device.
20969 Returns:
20970 unsigned long long: Reference in which to return the energy consumption information.
20972 .. seealso:: `nvmlDeviceGetTotalEnergyConsumption`
20973 """
20974 cdef unsigned long long energy
20975 with nogil: 2Qb
20976 __status__ = nvmlDeviceGetTotalEnergyConsumption(<Device>device, &energy) 2Qb
20977 check_status(__status__) 2Qb
20978 return energy 2Qb
20981cpdef unsigned int device_get_enforced_power_limit(intptr_t device) except? 0:
20982 """Get the effective power limit that the driver enforces after taking into account all limiters.
20984 Args:
20985 device (intptr_t): The device to communicate with.
20987 Returns:
20988 unsigned int: Reference in which to return the power management limit in milliwatts.
20990 .. seealso:: `nvmlDeviceGetEnforcedPowerLimit`
20991 """
20992 cdef unsigned int limit
20993 with nogil:
20994 __status__ = nvmlDeviceGetEnforcedPowerLimit(<Device>device, &limit)
20995 check_status(__status__)
20996 return limit
20999cpdef tuple device_get_gpu_operation_mode(intptr_t device):
21000 """Retrieves the current GOM and pending GOM (the one that GPU will switch to after reboot).
21002 Args:
21003 device (intptr_t): The identifier of the target device.
21005 Returns:
21006 A 2-tuple containing:
21008 - int: Reference in which to return the current GOM.
21009 - int: Reference in which to return the pending GOM.
21011 .. seealso:: `nvmlDeviceGetGpuOperationMode`
21012 """
21013 cdef _GpuOperationMode current
21014 cdef _GpuOperationMode pending
21015 with nogil:
21016 __status__ = nvmlDeviceGetGpuOperationMode(<Device>device, ¤t, &pending)
21017 check_status(__status__)
21018 return (<int>current, <int>pending)
21021cpdef object device_get_memory_info_v2(intptr_t device):
21022 """Retrieves the amount of used, free, reserved and total memory available on the device, in bytes. nvmlDeviceGetMemoryInfo_v2 accounts separately for reserved memory and includes it in the used memory amount.
21024 Args:
21025 device (intptr_t): The identifier of the target device.
21027 Returns:
21028 nvmlMemory_v2_t: Reference in which to return the memory information.
21030 .. seealso:: `nvmlDeviceGetMemoryInfo_v2`
21031 """
21032 cdef Memory_v2 memory_py = Memory_v2() 1Fr
21033 cdef nvmlMemory_v2_t *memory = <nvmlMemory_v2_t *><intptr_t>(memory_py._get_ptr()) 1Fr
21034 memory.version = NVML_VERSION_STRUCT(sizeof(nvmlMemory_v2_t), 2) 1Fr
21035 with nogil: 1Fr
21036 __status__ = nvmlDeviceGetMemoryInfo_v2(<Device>device, memory) 1Fr
21037 check_status(__status__) 1Fr
21038 return memory_py 1Fr
21041cpdef int device_get_compute_mode(intptr_t device) except? -1:
21042 """Retrieves the current compute mode for the device.
21044 Args:
21045 device (intptr_t): The identifier of the target device.
21047 Returns:
21048 int: Reference in which to return the current compute mode.
21050 .. seealso:: `nvmlDeviceGetComputeMode`
21051 """
21052 cdef _ComputeMode mode
21053 with nogil: 1W
21054 __status__ = nvmlDeviceGetComputeMode(<Device>device, &mode) 1W
21055 check_status(__status__) 1W
21056 return <int>mode 1W
21059cpdef tuple device_get_cuda_compute_capability(intptr_t device):
21060 """Retrieves the CUDA compute capability of the device.
21062 Args:
21063 device (intptr_t): The identifier of the target device.
21065 Returns:
21066 A 2-tuple containing:
21068 - int: Reference in which to return the major CUDA compute capability.
21069 - int: Reference in which to return the minor CUDA compute capability.
21071 .. seealso:: `nvmlDeviceGetCudaComputeCapability`
21072 """
21073 cdef int major
21074 cdef int minor
21075 with nogil: 1+
21076 __status__ = nvmlDeviceGetCudaComputeCapability(<Device>device, &major, &minor) 1+
21077 check_status(__status__) 1+
21078 return (major, minor) 1+
21081cpdef tuple device_get_ecc_mode(intptr_t device):
21082 """Retrieves the current and pending ECC modes for the device.
21084 Args:
21085 device (intptr_t): The identifier of the target device.
21087 Returns:
21088 A 2-tuple containing:
21090 - int: Reference in which to return the current ECC mode.
21091 - int: Reference in which to return the pending ECC mode.
21093 .. seealso:: `nvmlDeviceGetEccMode`
21094 """
21095 cdef _EnableState current
21096 cdef _EnableState pending
21097 with nogil: 1K
21098 __status__ = nvmlDeviceGetEccMode(<Device>device, ¤t, &pending) 1K
21099 check_status(__status__) 1K
21100 return (<int>current, <int>pending) 1K
21103cpdef int device_get_default_ecc_mode(intptr_t device) except? -1:
21104 """Retrieves the default ECC modes for the device.
21106 Args:
21107 device (intptr_t): The identifier of the target device.
21109 Returns:
21110 int: Reference in which to return the default ECC mode.
21112 .. seealso:: `nvmlDeviceGetDefaultEccMode`
21113 """
21114 cdef _EnableState default_mode
21115 with nogil:
21116 __status__ = nvmlDeviceGetDefaultEccMode(<Device>device, &default_mode)
21117 check_status(__status__)
21118 return <int>default_mode
21121cpdef unsigned int device_get_board_id(intptr_t device) except? 0:
21122 """Retrieves the device boardId from 0-N. Devices with the same boardId indicate GPUs connected to the same PLX. Use in conjunction with :func:`device_get_multi_gpu_board` to decide if they are on the same board as well. The boardId returned is a unique ID for the current configuration. Uniqueness and ordering across reboots and system configurations is not guaranteed (i.e. if a Tesla K40c returns 0x100 and the two GPUs on a Tesla K10 in the same system returns 0x200 it is not guaranteed they will always return those values but they will always be different from each other).
21124 Args:
21125 device (intptr_t): The identifier of the target device.
21127 Returns:
21128 unsigned int: Reference in which to return the device's board ID.
21130 .. seealso:: `nvmlDeviceGetBoardId`
21131 """
21132 cdef unsigned int board_id
21133 with nogil:
21134 __status__ = nvmlDeviceGetBoardId(<Device>device, &board_id)
21135 check_status(__status__)
21136 return board_id
21139cpdef unsigned int device_get_multi_gpu_board(intptr_t device) except? 0:
21140 """Retrieves whether the device is on a Multi-GPU Board Devices that are on multi-GPU boards will set ``multiGpuBool`` to a non-zero value.
21142 Args:
21143 device (intptr_t): The identifier of the target device.
21145 Returns:
21146 unsigned int: Reference in which to return a zero or non-zero value to indicate whether the device is on a multi GPU board.
21148 .. seealso:: `nvmlDeviceGetMultiGpuBoard`
21149 """
21150 cdef unsigned int multi_gpu_bool
21151 with nogil:
21152 __status__ = nvmlDeviceGetMultiGpuBoard(<Device>device, &multi_gpu_bool)
21153 check_status(__status__)
21154 return multi_gpu_bool
21157cpdef unsigned long long device_get_total_ecc_errors(intptr_t device, int error_type, int counter_type) except? 0:
21158 """Retrieves the total ECC error counts for the device.
21160 Args:
21161 device (intptr_t): The identifier of the target device.
21162 error_type (MemoryErrorType): Flag that specifies the type of the errors.
21163 counter_type (EccCounterType): Flag that specifies the counter-type of the errors.
21165 Returns:
21166 unsigned long long: Reference in which to return the specified ECC errors.
21168 .. seealso:: `nvmlDeviceGetTotalEccErrors`
21169 """
21170 cdef unsigned long long ecc_counts
21171 with nogil:
21172 __status__ = nvmlDeviceGetTotalEccErrors(<Device>device, <_MemoryErrorType>error_type, <_EccCounterType>counter_type, &ecc_counts)
21173 check_status(__status__)
21174 return ecc_counts
21177cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int error_type, int counter_type, int location_type) except? 0:
21178 """Retrieves the requested memory error counter for the device.
21180 Args:
21181 device (intptr_t): The identifier of the target device.
21182 error_type (MemoryErrorType): Flag that specifies the type of error.
21183 counter_type (EccCounterType): Flag that specifies the counter-type of the errors.
21184 location_type (MemoryLocation): Specifies the location of the counter.
21186 Returns:
21187 unsigned long long: Reference in which to return the ECC counter.
21189 .. seealso:: `nvmlDeviceGetMemoryErrorCounter`
21190 """
21191 cdef unsigned long long count
21192 with nogil:
21193 __status__ = nvmlDeviceGetMemoryErrorCounter(<Device>device, <_MemoryErrorType>error_type, <_EccCounterType>counter_type, <_MemoryLocation>location_type, &count)
21194 check_status(__status__)
21195 return count
21198cpdef object device_get_utilization_rates(intptr_t device):
21199 """Retrieves the current utilization rates for the device's major subsystems.
21201 Args:
21202 device (intptr_t): The identifier of the target device.
21204 Returns:
21205 nvmlUtilization_t: Reference in which to return the utilization information.
21207 .. seealso:: `nvmlDeviceGetUtilizationRates`
21208 """
21209 cdef Utilization utilization_py = Utilization() 1U
21210 cdef nvmlUtilization_t *utilization = <nvmlUtilization_t *><intptr_t>(utilization_py._get_ptr()) 1U
21211 with nogil: 1U
21212 __status__ = nvmlDeviceGetUtilizationRates(<Device>device, utilization) 1U
21213 check_status(__status__) 1U
21214 return utilization_py 1U
21217cpdef tuple device_get_encoder_utilization(intptr_t device):
21218 """Retrieves the current utilization and sampling size in microseconds for the Encoder.
21220 Args:
21221 device (intptr_t): The identifier of the target device.
21223 Returns:
21224 A 2-tuple containing:
21226 - unsigned int: Reference to an unsigned int for encoder utilization info.
21227 - unsigned int: Reference to an unsigned int for the sampling period in US.
21229 .. seealso:: `nvmlDeviceGetEncoderUtilization`
21230 """
21231 cdef unsigned int utilization
21232 cdef unsigned int sampling_period_us
21233 with nogil:
21234 __status__ = nvmlDeviceGetEncoderUtilization(<Device>device, &utilization, &sampling_period_us)
21235 check_status(__status__)
21236 return (utilization, sampling_period_us)
21239cpdef unsigned int device_get_encoder_capacity(intptr_t device, int encoder_query_type) except? 0:
21240 """Retrieves the current capacity of the device's encoder, as a percentage of maximum encoder capacity with valid values in the range 0-100.
21242 Args:
21243 device (intptr_t): The identifier of the target device.
21244 encoder_query_type (EncoderType): Type of encoder to query.
21246 Returns:
21247 unsigned int: Reference to an unsigned int for the encoder capacity.
21249 .. seealso:: `nvmlDeviceGetEncoderCapacity`
21250 """
21251 cdef unsigned int encoder_capacity
21252 with nogil:
21253 __status__ = nvmlDeviceGetEncoderCapacity(<Device>device, <_EncoderType>encoder_query_type, &encoder_capacity)
21254 check_status(__status__)
21255 return encoder_capacity
21258cpdef tuple device_get_encoder_stats(intptr_t device):
21259 """Retrieves the current encoder statistics for a given device.
21261 Args:
21262 device (intptr_t): The identifier of the target device.
21264 Returns:
21265 A 3-tuple containing:
21267 - unsigned int: Reference to an unsigned int for count of active encoder sessions.
21268 - unsigned int: Reference to an unsigned int for trailing average FPS of all active sessions.
21269 - unsigned int: Reference to an unsigned int for encode latency in microseconds.
21271 .. seealso:: `nvmlDeviceGetEncoderStats`
21272 """
21273 cdef unsigned int session_count
21274 cdef unsigned int average_fps
21275 cdef unsigned int average_latency
21276 with nogil:
21277 __status__ = nvmlDeviceGetEncoderStats(<Device>device, &session_count, &average_fps, &average_latency)
21278 check_status(__status__)
21279 return (session_count, average_fps, average_latency)
21282cpdef object device_get_encoder_sessions(intptr_t device):
21283 """Retrieves information about active encoder sessions on a target device.
21285 Args:
21286 device (intptr_t): The identifier of the target device.
21288 .. seealso:: `nvmlDeviceGetEncoderSessions`
21289 """
21290 cdef unsigned int[1] session_count = [0]
21291 with nogil:
21292 __status__ = nvmlDeviceGetEncoderSessions(<Device>device, <unsigned int*>session_count, NULL)
21293 check_status_size(__status__)
21294 cdef EncoderSessionInfo session_infos = EncoderSessionInfo(session_count[0])
21295 cdef nvmlEncoderSessionInfo_t *session_infos_ptr = <nvmlEncoderSessionInfo_t *><intptr_t>(session_infos._get_ptr())
21296 if session_count[0] == 0:
21297 return session_infos
21298 with nogil:
21299 __status__ = nvmlDeviceGetEncoderSessions(<Device>device, <unsigned int*>session_count, session_infos_ptr)
21300 check_status(__status__)
21301 return session_infos
21304cpdef tuple device_get_decoder_utilization(intptr_t device):
21305 """Retrieves the current utilization and sampling size in microseconds for the Decoder.
21307 Args:
21308 device (intptr_t): The identifier of the target device.
21310 Returns:
21311 A 2-tuple containing:
21313 - unsigned int: Reference to an unsigned int for decoder utilization info.
21314 - unsigned int: Reference to an unsigned int for the sampling period in US.
21316 .. seealso:: `nvmlDeviceGetDecoderUtilization`
21317 """
21318 cdef unsigned int utilization
21319 cdef unsigned int sampling_period_us
21320 with nogil:
21321 __status__ = nvmlDeviceGetDecoderUtilization(<Device>device, &utilization, &sampling_period_us)
21322 check_status(__status__)
21323 return (utilization, sampling_period_us)
21326cpdef tuple device_get_jpg_utilization(intptr_t device):
21327 """Retrieves the current utilization and sampling size in microseconds for the JPG.
21329 Args:
21330 device (intptr_t): The identifier of the target device.
21332 Returns:
21333 A 2-tuple containing:
21335 - unsigned int: Reference to an unsigned int for jpg utilization info.
21336 - unsigned int: Reference to an unsigned int for the sampling period in US.
21338 .. seealso:: `nvmlDeviceGetJpgUtilization`
21339 """
21340 cdef unsigned int utilization
21341 cdef unsigned int sampling_period_us
21342 with nogil:
21343 __status__ = nvmlDeviceGetJpgUtilization(<Device>device, &utilization, &sampling_period_us)
21344 check_status(__status__)
21345 return (utilization, sampling_period_us)
21348cpdef tuple device_get_ofa_utilization(intptr_t device):
21349 """Retrieves the current utilization and sampling size in microseconds for the OFA (Optical Flow Accelerator).
21351 Args:
21352 device (intptr_t): The identifier of the target device.
21354 Returns:
21355 A 2-tuple containing:
21357 - unsigned int: Reference to an unsigned int for ofa utilization info.
21358 - unsigned int: Reference to an unsigned int for the sampling period in US.
21360 .. seealso:: `nvmlDeviceGetOfaUtilization`
21361 """
21362 cdef unsigned int utilization
21363 cdef unsigned int sampling_period_us
21364 with nogil:
21365 __status__ = nvmlDeviceGetOfaUtilization(<Device>device, &utilization, &sampling_period_us)
21366 check_status(__status__)
21367 return (utilization, sampling_period_us)
21370cpdef object device_get_fbc_stats(intptr_t device):
21371 """Retrieves the active frame buffer capture sessions statistics for a given device.
21373 Args:
21374 device (intptr_t): The identifier of the target device.
21376 Returns:
21377 nvmlFBCStats_t: Reference to nvmlFBCStats_t structure containing NvFBC stats.
21379 .. seealso:: `nvmlDeviceGetFBCStats`
21380 """
21381 cdef FBCStats fbc_stats_py = FBCStats()
21382 cdef nvmlFBCStats_t *fbc_stats = <nvmlFBCStats_t *><intptr_t>(fbc_stats_py._get_ptr())
21383 with nogil:
21384 __status__ = nvmlDeviceGetFBCStats(<Device>device, fbc_stats)
21385 check_status(__status__)
21386 return fbc_stats_py
21389cpdef object device_get_fbc_sessions(intptr_t device):
21390 """Retrieves information about active frame buffer capture sessions on a target device.
21392 Args:
21393 device (intptr_t): The identifier of the target device.
21395 .. seealso:: `nvmlDeviceGetFBCSessions`
21396 """
21397 cdef unsigned int[1] session_count = [0]
21398 with nogil:
21399 __status__ = nvmlDeviceGetFBCSessions(<Device>device, <unsigned int*>session_count, NULL)
21400 check_status_size(__status__)
21401 cdef FBCSessionInfo session_info = FBCSessionInfo(session_count[0])
21402 cdef nvmlFBCSessionInfo_t *session_info_ptr = <nvmlFBCSessionInfo_t *><intptr_t>(session_info._get_ptr())
21403 if session_count[0] == 0:
21404 return session_info
21405 with nogil:
21406 __status__ = nvmlDeviceGetFBCSessions(<Device>device, <unsigned int*>session_count, session_info_ptr)
21407 check_status(__status__)
21408 return session_info
21411cpdef tuple device_get_driver_model_v2(intptr_t device):
21412 """Retrieves the current and pending driver model for the device.
21414 Args:
21415 device (intptr_t): The identifier of the target device.
21417 Returns:
21418 A 2-tuple containing:
21420 - int: Reference in which to return the current driver model.
21421 - int: Reference in which to return the pending driver model.
21423 .. seealso:: `nvmlDeviceGetDriverModel_v2`
21424 """
21425 cdef _DriverModel current
21426 cdef _DriverModel pending
21427 with nogil:
21428 __status__ = nvmlDeviceGetDriverModel_v2(<Device>device, ¤t, &pending)
21429 check_status(__status__)
21430 return (<int>current, <int>pending)
21433cpdef str device_get_vbios_version(intptr_t device):
21434 """Get VBIOS version of the device.
21436 Args:
21437 device (intptr_t): The identifier of the target device.
21439 .. seealso:: `nvmlDeviceGetVbiosVersion`
21440 """
21441 cdef unsigned int length = 32
21442 cdef char[32] version
21443 with nogil:
21444 __status__ = nvmlDeviceGetVbiosVersion(<Device>device, version, length)
21445 check_status(__status__)
21446 return cpython.PyUnicode_FromString(version)
21449cpdef object device_get_bridge_chip_info(intptr_t device):
21450 """Get Bridge Chip Information for all the bridge chips on the board.
21452 Args:
21453 device (intptr_t): The identifier of the target device.
21455 Returns:
21456 nvmlBridgeChipHierarchy_t: Reference to the returned bridge chip Hierarchy.
21458 .. seealso:: `nvmlDeviceGetBridgeChipInfo`
21459 """
21460 cdef BridgeChipHierarchy bridge_hierarchy_py = BridgeChipHierarchy() 1s
21461 cdef nvmlBridgeChipHierarchy_t *bridge_hierarchy = <nvmlBridgeChipHierarchy_t *><intptr_t>(bridge_hierarchy_py._get_ptr()) 1s
21462 with nogil: 1s
21463 __status__ = nvmlDeviceGetBridgeChipInfo(<Device>device, bridge_hierarchy) 1s
21464 check_status(__status__) 1s
21465 return bridge_hierarchy_py
21468cpdef object device_get_compute_running_processes_v3(intptr_t device):
21469 """Get information about processes with a compute context on a device.
21471 Args:
21472 device (intptr_t): The device handle or MIG device handle.
21474 .. seealso:: `nvmlDeviceGetComputeRunningProcesses_v3`
21475 """
21476 cdef unsigned int[1] info_count = [0]
21477 with nogil:
21478 __status__ = nvmlDeviceGetComputeRunningProcesses_v3(<Device>device, <unsigned int*>info_count, NULL)
21479 check_status_size(__status__)
21480 cdef ProcessInfo infos = ProcessInfo(info_count[0])
21481 cdef nvmlProcessInfo_t *infos_ptr = <nvmlProcessInfo_t *><intptr_t>(infos._get_ptr())
21482 if info_count[0] == 0:
21483 return infos
21484 with nogil:
21485 __status__ = nvmlDeviceGetComputeRunningProcesses_v3(<Device>device, <unsigned int*>info_count, infos_ptr)
21486 check_status(__status__)
21487 return infos
21490cpdef object device_get_mps_compute_running_processes_v3(intptr_t device):
21491 """Get information about processes with a Multi-Process Service (MPS) compute context on a device.
21493 Args:
21494 device (intptr_t): The device handle or MIG device handle.
21496 .. seealso:: `nvmlDeviceGetMPSComputeRunningProcesses_v3`
21497 """
21498 cdef unsigned int[1] info_count = [0]
21499 with nogil:
21500 __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(<Device>device, <unsigned int*>info_count, NULL)
21501 check_status_size(__status__)
21502 cdef ProcessInfo infos = ProcessInfo(info_count[0])
21503 cdef nvmlProcessInfo_t *infos_ptr = <nvmlProcessInfo_t *><intptr_t>(infos._get_ptr())
21504 if info_count[0] == 0:
21505 return infos
21506 with nogil:
21507 __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(<Device>device, <unsigned int*>info_count, infos_ptr)
21508 check_status(__status__)
21509 return infos
21512cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0:
21513 """Check if the GPU devices are on the same physical board.
21515 Args:
21516 device1 (intptr_t): The first GPU device.
21517 device2 (intptr_t): The second GPU device.
21519 Returns:
21520 int: Reference in which to return the status. Non-zero indicates that the GPUs are on the same board.
21522 .. seealso:: `nvmlDeviceOnSameBoard`
21523 """
21524 cdef int on_same_board
21525 with nogil:
21526 __status__ = nvmlDeviceOnSameBoard(<Device>device1, <Device>device2, &on_same_board)
21527 check_status(__status__)
21528 return on_same_board
21531cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1:
21532 """Retrieves the root/admin permissions on the target API. See ``nvmlRestrictedAPI_t`` for the list of supported APIs. If an API is restricted only root users can call that API. See ``nvmlDeviceSetAPIRestriction`` to change current permissions.
21534 Args:
21535 device (intptr_t): The identifier of the target device.
21536 api_type (RestrictedAPI): Target API type for this operation.
21538 Returns:
21539 int: Reference in which to return the current restriction NVML_FEATURE_ENABLED indicates that the API is root-only NVML_FEATURE_DISABLED indicates that the API is accessible to all users.
21541 .. seealso:: `nvmlDeviceGetAPIRestriction`
21542 """
21543 cdef _EnableState is_restricted
21544 with nogil:
21545 __status__ = nvmlDeviceGetAPIRestriction(<Device>device, <_RestrictedAPI>api_type, &is_restricted)
21546 check_status(__status__)
21547 return <int>is_restricted
21550cpdef object device_get_bar1_memory_info(intptr_t device):
21551 """Gets Total, Available and Used size of BAR1 memory.
21553 Args:
21554 device (intptr_t): The identifier of the target device.
21556 Returns:
21557 nvmlBAR1Memory_t: Reference in which BAR1 memory information is returned.
21559 .. seealso:: `nvmlDeviceGetBAR1MemoryInfo`
21560 """
21561 cdef BAR1Memory bar1memory_py = BAR1Memory() 1y
21562 cdef nvmlBAR1Memory_t *bar1memory = <nvmlBAR1Memory_t *><intptr_t>(bar1memory_py._get_ptr()) 1y
21563 with nogil: 1y
21564 __status__ = nvmlDeviceGetBAR1MemoryInfo(<Device>device, bar1memory) 1y
21565 check_status(__status__) 1y
21566 return bar1memory_py 1y
21569cpdef unsigned int device_get_irq_num(intptr_t device) except? 0:
21570 """Gets the device's interrupt number.
21572 Args:
21573 device (intptr_t): The identifier of the target device.
21575 Returns:
21576 unsigned int: The interrupt number associated with the specified device.
21578 .. seealso:: `nvmlDeviceGetIrqNum`
21579 """
21580 cdef unsigned int irq_num
21581 with nogil:
21582 __status__ = nvmlDeviceGetIrqNum(<Device>device, &irq_num)
21583 check_status(__status__)
21584 return irq_num
21587cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0:
21588 """Gets the device's core count.
21590 Args:
21591 device (intptr_t): The identifier of the target device.
21593 Returns:
21594 unsigned int: The number of cores for the specified device.
21596 .. seealso:: `nvmlDeviceGetNumGpuCores`
21597 """
21598 cdef unsigned int num_cores
21599 with nogil:
21600 __status__ = nvmlDeviceGetNumGpuCores(<Device>device, &num_cores)
21601 check_status(__status__)
21602 return num_cores
21605cpdef unsigned int device_get_power_source(intptr_t device) except *:
21606 """Gets the devices power source.
21608 Args:
21609 device (intptr_t): The identifier of the target device.
21611 Returns:
21612 unsigned int: The power source of the device.
21614 .. seealso:: `nvmlDeviceGetPowerSource`
21615 """
21616 cdef nvmlPowerSource_t power_source
21617 with nogil:
21618 __status__ = nvmlDeviceGetPowerSource(<Device>device, &power_source)
21619 check_status(__status__)
21620 return <unsigned int>power_source
21623cpdef unsigned int device_get_memory_bus_width(intptr_t device) except? 0:
21624 """Gets the device's memory bus width.
21626 Args:
21627 device (intptr_t): The identifier of the target device.
21629 Returns:
21630 unsigned int: The devices's memory bus width.
21632 .. seealso:: `nvmlDeviceGetMemoryBusWidth`
21633 """
21634 cdef unsigned int bus_width
21635 with nogil:
21636 __status__ = nvmlDeviceGetMemoryBusWidth(<Device>device, &bus_width)
21637 check_status(__status__)
21638 return bus_width
21641cpdef unsigned int device_get_pcie_link_max_speed(intptr_t device) except? 0:
21642 """Gets the device's PCIE Max Link speed in MBPS.
21644 Args:
21645 device (intptr_t): The identifier of the target device.
21647 Returns:
21648 unsigned int: The devices's PCIE Max Link speed in MBPS.
21650 .. seealso:: `nvmlDeviceGetPcieLinkMaxSpeed`
21651 """
21652 cdef unsigned int max_speed
21653 with nogil:
21654 __status__ = nvmlDeviceGetPcieLinkMaxSpeed(<Device>device, &max_speed)
21655 check_status(__status__)
21656 return max_speed
21659cpdef unsigned int device_get_pcie_speed(intptr_t device) except? 0:
21660 """Gets the device's PCIe Link speed in Mbps.
21662 Args:
21663 device (intptr_t): The identifier of the target device.
21665 Returns:
21666 unsigned int: The devices's PCIe Max Link speed in Mbps.
21668 .. seealso:: `nvmlDeviceGetPcieSpeed`
21669 """
21670 cdef unsigned int pcie_speed
21671 with nogil:
21672 __status__ = nvmlDeviceGetPcieSpeed(<Device>device, &pcie_speed)
21673 check_status(__status__)
21674 return pcie_speed
21677cpdef unsigned int device_get_adaptive_clock_info_status(intptr_t device) except? 0:
21678 """Gets the device's Adaptive Clock status.
21680 Args:
21681 device (intptr_t): The identifier of the target device.
21683 Returns:
21684 unsigned int: The current adaptive clocking status, either NVML_ADAPTIVE_CLOCKING_INFO_STATUS_DISABLED or NVML_ADAPTIVE_CLOCKING_INFO_STATUS_ENABLED.
21686 .. seealso:: `nvmlDeviceGetAdaptiveClockInfoStatus`
21687 """
21688 cdef unsigned int adaptive_clock_status
21689 with nogil:
21690 __status__ = nvmlDeviceGetAdaptiveClockInfoStatus(<Device>device, &adaptive_clock_status)
21691 check_status(__status__)
21692 return adaptive_clock_status
21695cpdef unsigned int device_get_bus_type(intptr_t device) except? 0:
21696 """Get the type of the GPU Bus (PCIe, PCI, ...).
21698 Args:
21699 device (intptr_t): The identifier of the target device.
21701 Returns:
21702 unsigned int: The PCI Bus type.
21704 .. seealso:: `nvmlDeviceGetBusType`
21705 """
21706 cdef nvmlBusType_t type
21707 with nogil:
21708 __status__ = nvmlDeviceGetBusType(<Device>device, &type)
21709 check_status(__status__)
21710 return <unsigned int>type
21713cpdef object system_get_conf_compute_capabilities():
21714 """Get Conf Computing System capabilities.
21716 Returns:
21717 nvmlConfComputeSystemCaps_t: System CC capabilities.
21719 .. seealso:: `nvmlSystemGetConfComputeCapabilities`
21720 """
21721 cdef ConfComputeSystemCaps capabilities_py = ConfComputeSystemCaps()
21722 cdef nvmlConfComputeSystemCaps_t *capabilities = <nvmlConfComputeSystemCaps_t *><intptr_t>(capabilities_py._get_ptr())
21723 with nogil:
21724 __status__ = nvmlSystemGetConfComputeCapabilities(capabilities)
21725 check_status(__status__)
21726 return capabilities_py
21729cpdef object system_get_conf_compute_state():
21730 """Get Conf Computing System State.
21732 Returns:
21733 nvmlConfComputeSystemState_t: System CC State.
21735 .. seealso:: `nvmlSystemGetConfComputeState`
21736 """
21737 cdef ConfComputeSystemState state_py = ConfComputeSystemState()
21738 cdef nvmlConfComputeSystemState_t *state = <nvmlConfComputeSystemState_t *><intptr_t>(state_py._get_ptr())
21739 with nogil:
21740 __status__ = nvmlSystemGetConfComputeState(state)
21741 check_status(__status__)
21742 return state_py
21745cpdef object device_get_conf_compute_mem_size_info(intptr_t device):
21746 """Get Conf Computing Protected and Unprotected Memory Sizes.
21748 Args:
21749 device (intptr_t): Device handle.
21751 Returns:
21752 nvmlConfComputeMemSizeInfo_t: Protected/Unprotected Memory sizes.
21754 .. seealso:: `nvmlDeviceGetConfComputeMemSizeInfo`
21755 """
21756 cdef ConfComputeMemSizeInfo mem_info_py = ConfComputeMemSizeInfo()
21757 cdef nvmlConfComputeMemSizeInfo_t *mem_info = <nvmlConfComputeMemSizeInfo_t *><intptr_t>(mem_info_py._get_ptr())
21758 with nogil:
21759 __status__ = nvmlDeviceGetConfComputeMemSizeInfo(<Device>device, mem_info)
21760 check_status(__status__)
21761 return mem_info_py
21764cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0:
21765 """Get Conf Computing GPUs ready state.
21767 Returns:
21768 unsigned int: Returns GPU current work accepting state, NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE or NVML_CC_ACCEPTING_CLIENT_REQUESTS_FALSE.
21770 .. seealso:: `nvmlSystemGetConfComputeGpusReadyState`
21771 """
21772 cdef unsigned int is_accepting_work
21773 with nogil:
21774 __status__ = nvmlSystemGetConfComputeGpusReadyState(&is_accepting_work)
21775 check_status(__status__)
21776 return is_accepting_work
21779cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device):
21780 """Get Conf Computing protected memory usage.
21782 Args:
21783 device (intptr_t): The identifier of the target device.
21785 Returns:
21786 nvmlMemory_t: Reference in which to return the memory information.
21788 .. seealso:: `nvmlDeviceGetConfComputeProtectedMemoryUsage`
21789 """
21790 cdef Memory memory_py = Memory()
21791 cdef nvmlMemory_t *memory = <nvmlMemory_t *><intptr_t>(memory_py._get_ptr())
21792 with nogil:
21793 __status__ = nvmlDeviceGetConfComputeProtectedMemoryUsage(<Device>device, memory)
21794 check_status(__status__)
21795 return memory_py
21798cpdef object device_get_conf_compute_gpu_certificate(intptr_t device):
21799 """Get Conf Computing GPU certificate details.
21801 Args:
21802 device (intptr_t): The identifier of the target device.
21804 Returns:
21805 nvmlConfComputeGpuCertificate_t: Reference in which to return the gpu certificate information.
21807 .. seealso:: `nvmlDeviceGetConfComputeGpuCertificate`
21808 """
21809 cdef ConfComputeGpuCertificate gpu_cert_py = ConfComputeGpuCertificate() 1C
21810 cdef nvmlConfComputeGpuCertificate_t *gpu_cert = <nvmlConfComputeGpuCertificate_t *><intptr_t>(gpu_cert_py._get_ptr()) 1C
21811 with nogil: 1C
21812 __status__ = nvmlDeviceGetConfComputeGpuCertificate(<Device>device, gpu_cert) 1C
21813 check_status(__status__) 1C
21814 return gpu_cert_py
21817cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned long long size_ki_b):
21818 """Set Conf Computing Unprotected Memory Size.
21820 Args:
21821 device (intptr_t): Device Handle.
21822 size_ki_b (unsigned long long): Unprotected Memory size to be set in KiB.
21824 .. seealso:: `nvmlDeviceSetConfComputeUnprotectedMemSize`
21825 """
21826 with nogil:
21827 __status__ = nvmlDeviceSetConfComputeUnprotectedMemSize(<Device>device, size_ki_b)
21828 check_status(__status__)
21831cpdef system_set_conf_compute_gpus_ready_state(unsigned int is_accepting_work):
21832 """Set Conf Computing GPUs ready state.
21834 Args:
21835 is_accepting_work (unsigned int): GPU accepting new work, NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE or NVML_CC_ACCEPTING_CLIENT_REQUESTS_FALSE.
21837 .. seealso:: `nvmlSystemSetConfComputeGpusReadyState`
21838 """
21839 with nogil:
21840 __status__ = nvmlSystemSetConfComputeGpusReadyState(is_accepting_work)
21841 check_status(__status__)
21844cpdef object system_get_conf_compute_settings():
21845 """Get Conf Computing System Settings.
21847 Returns:
21848 nvmlSystemConfComputeSettings_v1_t: System CC settings.
21850 .. seealso:: `nvmlSystemGetConfComputeSettings`
21851 """
21852 cdef SystemConfComputeSettings_v1 settings_py = SystemConfComputeSettings_v1()
21853 cdef nvmlSystemConfComputeSettings_t *settings = <nvmlSystemConfComputeSettings_t *><intptr_t>(settings_py._get_ptr())
21854 settings.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemConfComputeSettings_v1_t), 1)
21855 with nogil:
21856 __status__ = nvmlSystemGetConfComputeSettings(settings)
21857 check_status(__status__)
21858 return settings_py
21861cpdef char device_get_gsp_firmware_version(intptr_t device) except? 0:
21862 """Retrieve GSP firmware version.
21864 Args:
21865 device (intptr_t): Device handle.
21867 Returns:
21868 char: The retrieved GSP firmware version.
21870 .. seealso:: `nvmlDeviceGetGspFirmwareVersion`
21871 """
21872 cdef char version
21873 with nogil:
21874 __status__ = nvmlDeviceGetGspFirmwareVersion(<Device>device, &version)
21875 check_status(__status__)
21876 return version
21879cpdef tuple device_get_gsp_firmware_mode(intptr_t device):
21880 """Retrieve GSP firmware mode.
21882 Args:
21883 device (intptr_t): Device handle.
21885 Returns:
21886 A 2-tuple containing:
21888 - unsigned int: Pointer to specify if GSP firmware is enabled.
21889 - unsigned int: Pointer to specify if GSP firmware is supported by default on ``device``.
21891 .. seealso:: `nvmlDeviceGetGspFirmwareMode`
21892 """
21893 cdef unsigned int is_enabled
21894 cdef unsigned int default_mode
21895 with nogil:
21896 __status__ = nvmlDeviceGetGspFirmwareMode(<Device>device, &is_enabled, &default_mode)
21897 check_status(__status__)
21898 return (is_enabled, default_mode)
21901cpdef object device_get_sram_ecc_error_status(intptr_t device):
21902 """Get SRAM ECC error status of this device.
21904 Args:
21905 device (intptr_t): The identifier of the target device.
21907 Returns:
21908 nvmlEccSramErrorStatus_v1_t: Returns SRAM ECC error status.
21910 .. seealso:: `nvmlDeviceGetSramEccErrorStatus`
21911 """
21912 cdef EccSramErrorStatus_v1 status_py = EccSramErrorStatus_v1()
21913 cdef nvmlEccSramErrorStatus_t *status = <nvmlEccSramErrorStatus_t *><intptr_t>(status_py._get_ptr())
21914 status.version = NVML_VERSION_STRUCT(sizeof(nvmlEccSramErrorStatus_v1_t), 1)
21915 with nogil:
21916 __status__ = nvmlDeviceGetSramEccErrorStatus(<Device>device, status)
21917 check_status(__status__)
21918 return status_py
21921cpdef int device_get_accounting_mode(intptr_t device) except? -1:
21922 """Queries the state of per process accounting mode.
21924 Args:
21925 device (intptr_t): The identifier of the target device.
21927 Returns:
21928 int: Reference in which to return the current accounting mode.
21930 .. seealso:: `nvmlDeviceGetAccountingMode`
21931 """
21932 cdef _EnableState mode
21933 with nogil:
21934 __status__ = nvmlDeviceGetAccountingMode(<Device>device, &mode)
21935 check_status(__status__)
21936 return <int>mode
21939cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid):
21940 """Queries process's accounting stats.
21942 Args:
21943 device (intptr_t): The identifier of the target device.
21944 pid (unsigned int): Process Id of the target process to query stats for.
21946 Returns:
21947 nvmlAccountingStats_t: Reference in which to return the process's accounting stats.
21949 .. seealso:: `nvmlDeviceGetAccountingStats`
21950 """
21951 cdef AccountingStats stats_py = AccountingStats()
21952 cdef nvmlAccountingStats_t *stats = <nvmlAccountingStats_t *><intptr_t>(stats_py._get_ptr())
21953 with nogil:
21954 __status__ = nvmlDeviceGetAccountingStats(<Device>device, pid, stats)
21955 check_status(__status__)
21956 return stats_py
21959cpdef object device_get_accounting_pids(intptr_t device):
21960 """Queries list of processes that can be queried for accounting stats. The list of processes returned can be in running or terminated state.
21962 Args:
21963 device (intptr_t): The identifier of the target device.
21965 .. seealso:: `nvmlDeviceGetAccountingPids`
21966 """
21967 cdef unsigned int[1] count = [0]
21968 with nogil:
21969 __status__ = nvmlDeviceGetAccountingPids(<Device>device, <unsigned int*>count, NULL)
21970 check_status_size(__status__)
21971 if count[0] == 0:
21972 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
21973 cdef view.array pids = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
21974 cdef unsigned int *pids_ptr = <unsigned int *>(pids.data)
21975 with nogil:
21976 __status__ = nvmlDeviceGetAccountingPids(<Device>device, <unsigned int*>count, pids_ptr)
21977 check_status(__status__)
21978 return pids
21981cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0:
21982 """Returns the number of processes that the circular buffer with accounting pids can hold.
21984 Args:
21985 device (intptr_t): The identifier of the target device.
21987 Returns:
21988 unsigned int: Reference in which to provide the size (in number of elements) of the circular buffer for accounting stats.
21990 .. seealso:: `nvmlDeviceGetAccountingBufferSize`
21991 """
21992 cdef unsigned int buffer_size
21993 with nogil:
21994 __status__ = nvmlDeviceGetAccountingBufferSize(<Device>device, &buffer_size)
21995 check_status(__status__)
21996 return buffer_size
21999cpdef object device_get_retired_pages(intptr_t device, int cause):
22000 """Returns the list of retired pages by source, including pages that are pending retirement The address information provided from this API is the hardware address of the page that was retired. Note that this does not match the virtual address used in CUDA, but will match the address information in Xid 63.
22002 Args:
22003 device (intptr_t): The identifier of the target device.
22004 cause (PageRetirementCause): Filter page addresses by cause of retirement.
22006 .. seealso:: `nvmlDeviceGetRetiredPages`
22007 """
22008 cdef unsigned int[1] page_count = [0] 1K8
22009 with nogil: 1K8
22010 __status__ = nvmlDeviceGetRetiredPages(<Device>device, <_PageRetirementCause>cause, <unsigned int*>page_count, NULL) 1K8
22011 check_status_size(__status__) 1K8
22012 if page_count[0] == 0:
22013 return view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0]
22014 cdef view.array addresses = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c")
22015 cdef unsigned long long *addresses_ptr = <unsigned long long *>(addresses.data)
22016 with nogil:
22017 __status__ = nvmlDeviceGetRetiredPages(<Device>device, <_PageRetirementCause>cause, <unsigned int*>page_count, addresses_ptr)
22018 check_status(__status__)
22019 return addresses
22022cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1:
22023 """Check if any pages are pending retirement and need a reboot to fully retire.
22025 Args:
22026 device (intptr_t): The identifier of the target device.
22028 Returns:
22029 int: Reference in which to return the pending status.
22031 .. seealso:: `nvmlDeviceGetRetiredPagesPendingStatus`
22032 """
22033 cdef _EnableState is_pending
22034 with nogil: 1K
22035 __status__ = nvmlDeviceGetRetiredPagesPendingStatus(<Device>device, &is_pending) 1K
22036 check_status(__status__) 1K
22037 return <int>is_pending
22040cpdef tuple device_get_remapped_rows(intptr_t device):
22041 """Get number of remapped rows. The number of rows reported will be based on the cause of the remapping. isPending indicates whether or not there are pending remappings. A reset will be required to actually remap the row. failureOccurred will be set if a row remapping ever failed in the past. A pending remapping won't affect future work on the GPU since error-containment and dynamic page blacklisting will take care of that.
22043 Args:
22044 device (intptr_t): The identifier of the target device.
22046 Returns:
22047 A 4-tuple containing:
22049 - unsigned int: Reference for number of rows remapped due to correctable errors.
22050 - unsigned int: Reference for number of rows remapped due to uncorrectable errors.
22051 - unsigned int: Reference for whether or not remappings are pending.
22052 - unsigned int: Reference that is set when a remapping has failed in the past.
22054 .. seealso:: `nvmlDeviceGetRemappedRows`
22055 """
22056 cdef unsigned int corr_rows
22057 cdef unsigned int unc_rows
22058 cdef unsigned int is_pending
22059 cdef unsigned int failure_occurred
22060 with nogil:
22061 __status__ = nvmlDeviceGetRemappedRows(<Device>device, &corr_rows, &unc_rows, &is_pending, &failure_occurred)
22062 check_status(__status__)
22063 return (corr_rows, unc_rows, is_pending, failure_occurred)
22066cpdef object device_get_row_remapper_histogram(intptr_t device):
22067 """Get the row remapper histogram. Returns the remap availability for each bank on the GPU.
22069 Args:
22070 device (intptr_t): Device handle.
22072 Returns:
22073 nvmlRowRemapperHistogramValues_t: Histogram values.
22075 .. seealso:: `nvmlDeviceGetRowRemapperHistogram`
22076 """
22077 cdef RowRemapperHistogramValues values_py = RowRemapperHistogramValues()
22078 cdef nvmlRowRemapperHistogramValues_t *values = <nvmlRowRemapperHistogramValues_t *><intptr_t>(values_py._get_ptr())
22079 with nogil:
22080 __status__ = nvmlDeviceGetRowRemapperHistogram(<Device>device, values)
22081 check_status(__status__)
22082 return values_py
22085cpdef unsigned int device_get_architecture(intptr_t device) except? 0:
22086 """Get architecture for device.
22088 Args:
22089 device (intptr_t): The identifier of the target device.
22091 Returns:
22092 unsigned int: Reference where architecture is returned, if call successful. Set to NVML_DEVICE_ARCH_* upon success.
22094 .. seealso:: `nvmlDeviceGetArchitecture`
22095 """
22096 cdef nvmlDeviceArchitecture_t arch
22097 with nogil: 2W nbobH p MbI J V N C z G D 7be s w : = @ ] F O P Q R S T ObPbQbU i E A j Y b ) k y Z r c 1 , d M g 7 B f t n
22098 __status__ = nvmlDeviceGetArchitecture(<Device>device, &arch) 2W nbobH p MbI J V N C z G D 7be s w : = @ ] F O P Q R S T ObPbQbU i E A j Y b ) k y Z r c 1 , d M g 7 B f t n
22099 check_status(__status__) 2W nbobH p MbI J V N C z G D 7be s w : = @ ] F O P Q R S T ObPbQbU i E A j Y b ) k y Z r c 1 , d M g 7 B f t n
22100 return <unsigned int>arch 2W nbobH p MbI J V N C z G D 7be s w : = @ ] F O P Q R S T ObPbQbU i E A j Y b ) k y Z r c 1 , d M g 7 B f t n
22103cpdef object device_get_clk_mon_status(intptr_t device):
22104 """Retrieves the frequency monitor fault status for the device.
22106 Args:
22107 device (intptr_t): The identifier of the target device.
22109 Returns:
22110 nvmlClkMonStatus_t: Reference in which to return the clkmon fault status.
22112 .. seealso:: `nvmlDeviceGetClkMonStatus`
22113 """
22114 cdef ClkMonStatus status_py = ClkMonStatus()
22115 cdef nvmlClkMonStatus_t *status = <nvmlClkMonStatus_t *><intptr_t>(status_py._get_ptr())
22116 with nogil:
22117 __status__ = nvmlDeviceGetClkMonStatus(<Device>device, status)
22118 check_status(__status__)
22119 return status_py
22122cpdef object device_get_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp):
22123 """Retrieves the current utilization and process ID.
22125 Args:
22126 device (intptr_t): The identifier of the target device.
22127 last_seen_time_stamp (unsigned long long): Pointer to caller-supplied buffer in which guest process utilization samples are returned.
22129 .. seealso:: `nvmlDeviceGetProcessUtilization`
22130 """
22131 cdef unsigned int[1] process_samples_count = [0]
22132 with nogil:
22133 __status__ = nvmlDeviceGetProcessUtilization(<Device>device, NULL, <unsigned int*>process_samples_count, last_seen_time_stamp)
22134 check_status_size(__status__)
22135 cdef ProcessUtilizationSample utilization = ProcessUtilizationSample(process_samples_count[0])
22136 cdef nvmlProcessUtilizationSample_t *utilization_ptr = <nvmlProcessUtilizationSample_t *><intptr_t>(utilization._get_ptr())
22137 if process_samples_count[0] == 0:
22138 return utilization
22139 with nogil:
22140 __status__ = nvmlDeviceGetProcessUtilization(<Device>device, utilization_ptr, <unsigned int*>process_samples_count, last_seen_time_stamp)
22141 check_status(__status__)
22142 return utilization
22145cpdef unit_set_led_state(intptr_t unit, int color):
22146 """Set the LED state for the unit. The LED can be either green (0) or amber (1).
22148 Args:
22149 unit (intptr_t): The identifier of the target unit.
22150 color (LedColor): The target LED color.
22152 .. seealso:: `nvmlUnitSetLedState`
22153 """
22154 with nogil:
22155 __status__ = nvmlUnitSetLedState(<Unit>unit, <_LedColor>color)
22156 check_status(__status__)
22159cpdef device_set_persistence_mode(intptr_t device, int mode):
22160 """Set the persistence mode for the device.
22162 Args:
22163 device (intptr_t): The identifier of the target device.
22164 mode (EnableState): The target persistence mode.
22166 .. seealso:: `nvmlDeviceSetPersistenceMode`
22167 """
22168 with nogil: 1!
22169 __status__ = nvmlDeviceSetPersistenceMode(<Device>device, <_EnableState>mode) 1!
22170 check_status(__status__) 1!
22173cpdef device_set_compute_mode(intptr_t device, int mode):
22174 """Set the compute mode for the device.
22176 Args:
22177 device (intptr_t): The identifier of the target device.
22178 mode (ComputeMode): The target compute mode.
22180 .. seealso:: `nvmlDeviceSetComputeMode`
22181 """
22182 with nogil: 1W
22183 __status__ = nvmlDeviceSetComputeMode(<Device>device, <_ComputeMode>mode) 1W
22184 check_status(__status__) 1W
22187cpdef device_set_ecc_mode(intptr_t device, int ecc):
22188 """Set the ECC mode for the device.
22190 Args:
22191 device (intptr_t): The identifier of the target device.
22192 ecc (EnableState): The target ECC mode.
22194 .. seealso:: `nvmlDeviceSetEccMode`
22195 """
22196 with nogil:
22197 __status__ = nvmlDeviceSetEccMode(<Device>device, <_EnableState>ecc)
22198 check_status(__status__)
22201cpdef device_clear_ecc_error_counts(intptr_t device, int counter_type):
22202 """Clear the ECC error and other memory error counts for the device.
22204 Args:
22205 device (intptr_t): The identifier of the target device.
22206 counter_type (EccCounterType): Flag that indicates which type of errors should be cleared.
22208 .. seealso:: `nvmlDeviceClearEccErrorCounts`
22209 """
22210 with nogil:
22211 __status__ = nvmlDeviceClearEccErrorCounts(<Device>device, <_EccCounterType>counter_type)
22212 check_status(__status__)
22215cpdef device_set_driver_model(intptr_t device, int driver_model, unsigned int flags):
22216 """Set the driver model for the device.
22218 Args:
22219 device (intptr_t): The identifier of the target device.
22220 driver_model (DriverModel): The target driver model.
22221 flags (unsigned int): Flags that change the default behavior.
22223 .. seealso:: `nvmlDeviceSetDriverModel`
22224 """
22225 with nogil:
22226 __status__ = nvmlDeviceSetDriverModel(<Device>device, <_DriverModel>driver_model, flags)
22227 check_status(__status__)
22230cpdef device_set_gpu_locked_clocks(intptr_t device, unsigned int min_gpu_clock_m_hz, unsigned int max_gpu_clock_m_hz):
22231 """Set clocks that device will lock to.
22233 Args:
22234 device (intptr_t): The identifier of the target device.
22235 min_gpu_clock_m_hz (unsigned int): Requested minimum gpu clock in MHz.
22236 max_gpu_clock_m_hz (unsigned int): Requested maximum gpu clock in MHz.
22238 .. seealso:: `nvmlDeviceSetGpuLockedClocks`
22239 """
22240 with nogil:
22241 __status__ = nvmlDeviceSetGpuLockedClocks(<Device>device, min_gpu_clock_m_hz, max_gpu_clock_m_hz)
22242 check_status(__status__)
22245cpdef device_reset_gpu_locked_clocks(intptr_t device):
22246 """Resets the gpu clock to the default value.
22248 Args:
22249 device (intptr_t): The identifier of the target device.
22251 .. seealso:: `nvmlDeviceResetGpuLockedClocks`
22252 """
22253 with nogil:
22254 __status__ = nvmlDeviceResetGpuLockedClocks(<Device>device)
22255 check_status(__status__)
22258cpdef device_set_memory_locked_clocks(intptr_t device, unsigned int min_mem_clock_m_hz, unsigned int max_mem_clock_m_hz):
22259 """Set memory clocks that device will lock to.
22261 Args:
22262 device (intptr_t): The identifier of the target device.
22263 min_mem_clock_m_hz (unsigned int): Requested minimum memory clock in MHz.
22264 max_mem_clock_m_hz (unsigned int): Requested maximum memory clock in MHz.
22266 .. seealso:: `nvmlDeviceSetMemoryLockedClocks`
22267 """
22268 with nogil:
22269 __status__ = nvmlDeviceSetMemoryLockedClocks(<Device>device, min_mem_clock_m_hz, max_mem_clock_m_hz)
22270 check_status(__status__)
22273cpdef device_reset_memory_locked_clocks(intptr_t device):
22274 """Resets the memory clock to the default value.
22276 Args:
22277 device (intptr_t): The identifier of the target device.
22279 .. seealso:: `nvmlDeviceResetMemoryLockedClocks`
22280 """
22281 with nogil:
22282 __status__ = nvmlDeviceResetMemoryLockedClocks(<Device>device)
22283 check_status(__status__)
22286cpdef device_set_auto_boosted_clocks_enabled(intptr_t device, int enabled):
22287 """Try to set the current state of Auto Boosted clocks on a device.
22289 Args:
22290 device (intptr_t): The identifier of the target device.
22291 enabled (EnableState): What state to try to set Auto Boosted clocks of the target device to.
22293 .. seealso:: `nvmlDeviceSetAutoBoostedClocksEnabled`
22294 """
22295 with nogil:
22296 __status__ = nvmlDeviceSetAutoBoostedClocksEnabled(<Device>device, <_EnableState>enabled)
22297 check_status(__status__)
22300cpdef device_set_default_auto_boosted_clocks_enabled(intptr_t device, int enabled, unsigned int flags):
22301 """Try to set the default state of Auto Boosted clocks on a device. This is the default state that Auto Boosted clocks will return to when no compute running processes (e.g. CUDA application which have an active context) are running.
22303 Args:
22304 device (intptr_t): The identifier of the target device.
22305 enabled (EnableState): What state to try to set default Auto Boosted clocks of the target device to.
22306 flags (unsigned int): Flags that change the default behavior. Currently Unused.
22308 .. seealso:: `nvmlDeviceSetDefaultAutoBoostedClocksEnabled`
22309 """
22310 with nogil:
22311 __status__ = nvmlDeviceSetDefaultAutoBoostedClocksEnabled(<Device>device, <_EnableState>enabled, flags)
22312 check_status(__status__)
22315cpdef device_set_default_fan_speed_v2(intptr_t device, unsigned int fan):
22316 """Sets the speed of the fan control policy to default.
22318 Args:
22319 device (intptr_t): The identifier of the target device.
22320 fan (unsigned int): The index of the fan, starting at zero.
22322 .. seealso:: `nvmlDeviceSetDefaultFanSpeed_v2`
22323 """
22324 with nogil:
22325 __status__ = nvmlDeviceSetDefaultFanSpeed_v2(<Device>device, fan)
22326 check_status(__status__)
22329cpdef device_set_fan_control_policy(intptr_t device, unsigned int fan, unsigned int policy):
22330 """Sets current fan control policy.
22332 Args:
22333 device (intptr_t): The identifier of the target ``device``.
22334 fan (unsigned int): The index of the fan, starting at zero.
22335 policy (unsigned int): The fan control ``policy`` to set.
22337 .. seealso:: `nvmlDeviceSetFanControlPolicy`
22338 """
22339 with nogil:
22340 __status__ = nvmlDeviceSetFanControlPolicy(<Device>device, fan, <nvmlFanControlPolicy_t>policy)
22341 check_status(__status__)
22344cpdef device_set_gpu_operation_mode(intptr_t device, int mode):
22345 """Sets new GOM. See ``nvmlGpuOperationMode_t`` for details.
22347 Args:
22348 device (intptr_t): The identifier of the target device.
22349 mode (GpuOperationMode): Target GOM.
22351 .. seealso:: `nvmlDeviceSetGpuOperationMode`
22352 """
22353 with nogil:
22354 __status__ = nvmlDeviceSetGpuOperationMode(<Device>device, <_GpuOperationMode>mode)
22355 check_status(__status__)
22358cpdef device_set_api_restriction(intptr_t device, int api_type, int is_restricted):
22359 """Changes the root/admin restructions on certain APIs. See ``nvmlRestrictedAPI_t`` for the list of supported APIs. This method can be used by a root/admin user to give non-root/admin access to certain otherwise-restricted APIs. The new setting lasts for the lifetime of the NVIDIA driver; it is not persistent. See ``nvmlDeviceGetAPIRestriction`` to query the current restriction settings.
22361 Args:
22362 device (intptr_t): The identifier of the target device.
22363 api_type (RestrictedAPI): Target API type for this operation.
22364 is_restricted (EnableState): The target restriction.
22366 .. seealso:: `nvmlDeviceSetAPIRestriction`
22367 """
22368 with nogil:
22369 __status__ = nvmlDeviceSetAPIRestriction(<Device>device, <_RestrictedAPI>api_type, <_EnableState>is_restricted)
22370 check_status(__status__)
22373cpdef device_set_fan_speed_v2(intptr_t device, unsigned int fan, unsigned int speed):
22374 """Sets the speed of a specified fan.
22376 Args:
22377 device (intptr_t): The identifier of the target device.
22378 fan (unsigned int): The index of the fan, starting at zero.
22379 speed (unsigned int): The target speed of the fan [0-100] in % of max speed.
22381 .. seealso:: `nvmlDeviceSetFanSpeed_v2`
22382 """
22383 with nogil:
22384 __status__ = nvmlDeviceSetFanSpeed_v2(<Device>device, fan, speed)
22385 check_status(__status__)
22388cpdef device_set_accounting_mode(intptr_t device, int mode):
22389 """Enables or disables per process accounting.
22391 Args:
22392 device (intptr_t): The identifier of the target device.
22393 mode (EnableState): The target accounting mode.
22395 .. seealso:: `nvmlDeviceSetAccountingMode`
22396 """
22397 with nogil:
22398 __status__ = nvmlDeviceSetAccountingMode(<Device>device, <_EnableState>mode)
22399 check_status(__status__)
22402cpdef device_clear_accounting_pids(intptr_t device):
22403 """Clears accounting information about all processes that have already terminated.
22405 Args:
22406 device (intptr_t): The identifier of the target device.
22408 .. seealso:: `nvmlDeviceClearAccountingPids`
22409 """
22410 with nogil:
22411 __status__ = nvmlDeviceClearAccountingPids(<Device>device)
22412 check_status(__status__)
22415cpdef int device_get_nvlink_state(intptr_t device, unsigned int link) except? -1:
22416 """Retrieves the state of the device's NvLink for the link specified.
22418 Args:
22419 device (intptr_t): The identifier of the target device.
22420 link (unsigned int): Specifies the NvLink link to be queried.
22422 Returns:
22423 int: ``nvmlEnableState_t`` where NVML_FEATURE_ENABLED indicates that the link is active and NVML_FEATURE_DISABLED indicates it is inactive.
22425 .. seealso:: `nvmlDeviceGetNvLinkState`
22426 """
22427 cdef _EnableState is_active
22428 with nogil:
22429 __status__ = nvmlDeviceGetNvLinkState(<Device>device, link, &is_active)
22430 check_status(__status__)
22431 return <int>is_active
22434cpdef unsigned int device_get_nvlink_version(intptr_t device, unsigned int link) except? 0:
22435 """Retrieves the version of the device's NvLink for the link specified.
22437 Args:
22438 device (intptr_t): The identifier of the target device.
22439 link (unsigned int): Specifies the NvLink link to be queried.
22441 Returns:
22442 unsigned int: Requested NvLink version from ``nvmlNvlinkVersion_t``.
22444 .. seealso:: `nvmlDeviceGetNvLinkVersion`
22445 """
22446 cdef unsigned int version
22447 with nogil:
22448 __status__ = nvmlDeviceGetNvLinkVersion(<Device>device, link, &version)
22449 check_status(__status__)
22450 return version
22453cpdef unsigned int device_get_nvlink_capability(intptr_t device, unsigned int link, int capability) except? 0:
22454 """Retrieves the requested capability from the device's NvLink for the link specified Please refer to the ``nvmlNvLinkCapability_t`` structure for the specific caps that can be queried The return value should be treated as a boolean.
22456 Args:
22457 device (intptr_t): The identifier of the target device.
22458 link (unsigned int): Specifies the NvLink link to be queried.
22459 capability (NvLinkCapability): Specifies the ``nvmlNvLinkCapability_t`` to be queried.
22461 Returns:
22462 unsigned int: A boolean for the queried capability indicating that feature is available.
22464 .. seealso:: `nvmlDeviceGetNvLinkCapability`
22465 """
22466 cdef unsigned int cap_result
22467 with nogil: 1OPQRST
22468 __status__ = nvmlDeviceGetNvLinkCapability(<Device>device, link, <_NvLinkCapability>capability, &cap_result) 1OPQRST
22469 check_status(__status__) 1OPQRST
22470 return cap_result
22473cpdef object device_get_nvlink_remote_pci_info_v2(intptr_t device, unsigned int link):
22474 """Retrieves the PCI information for the remote node on a NvLink link Note: pciSubSystemId is not filled in this function and is indeterminate.
22476 Args:
22477 device (intptr_t): The identifier of the target device.
22478 link (unsigned int): Specifies the NvLink link to be queried.
22480 Returns:
22481 nvmlPciInfo_t: ``nvmlPciInfo_t`` of the remote node for the specified link.
22483 .. seealso:: `nvmlDeviceGetNvLinkRemotePciInfo_v2`
22484 """
22485 cdef PciInfo pci_py = PciInfo()
22486 cdef nvmlPciInfo_t *pci = <nvmlPciInfo_t *><intptr_t>(pci_py._get_ptr())
22487 with nogil:
22488 __status__ = nvmlDeviceGetNvLinkRemotePciInfo_v2(<Device>device, link, pci)
22489 check_status(__status__)
22490 return pci_py
22493cpdef unsigned long long device_get_nvlink_error_counter(intptr_t device, unsigned int link, int counter) except? 0:
22494 """Retrieves the specified error counter value Please refer to ``nvmlNvLinkErrorCounter_t`` for error counters that are available.
22496 Args:
22497 device (intptr_t): The identifier of the target device.
22498 link (unsigned int): Specifies the NvLink link to be queried.
22499 counter (NvLinkErrorCounter): Specifies the NvLink counter to be queried.
22501 Returns:
22502 unsigned long long: Returned counter value.
22504 .. seealso:: `nvmlDeviceGetNvLinkErrorCounter`
22505 """
22506 cdef unsigned long long counter_value
22507 with nogil:
22508 __status__ = nvmlDeviceGetNvLinkErrorCounter(<Device>device, link, <_NvLinkErrorCounter>counter, &counter_value)
22509 check_status(__status__)
22510 return counter_value
22513cpdef device_reset_nvlink_error_counters(intptr_t device, unsigned int link):
22514 """Resets all error counters to zero Please refer to ``nvmlNvLinkErrorCounter_t`` for the list of error counters that are reset.
22516 Args:
22517 device (intptr_t): The identifier of the target device.
22518 link (unsigned int): Specifies the NvLink link to be queried.
22520 .. seealso:: `nvmlDeviceResetNvLinkErrorCounters`
22521 """
22522 with nogil:
22523 __status__ = nvmlDeviceResetNvLinkErrorCounters(<Device>device, link)
22524 check_status(__status__)
22527cpdef int device_get_nvlink_remote_device_type(intptr_t device, unsigned int link) except? -1:
22528 """Get the NVLink device type of the remote device connected over the given link.
22530 Args:
22531 device (intptr_t): The device handle of the target GPU.
22532 link (unsigned int): The NVLink link index on the target GPU.
22534 Returns:
22535 int: Pointer in which the output remote device type is returned.
22537 .. seealso:: `nvmlDeviceGetNvLinkRemoteDeviceType`
22538 """
22539 cdef _IntNvLinkDeviceType p_nv_link_device_type
22540 with nogil:
22541 __status__ = nvmlDeviceGetNvLinkRemoteDeviceType(<Device>device, link, &p_nv_link_device_type)
22542 check_status(__status__)
22543 return <int>p_nv_link_device_type
22546cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode):
22547 """Set the global nvlink bandwith mode.
22549 Args:
22550 nvlink_bw_mode (unsigned int): nvlink bandwidth mode.
22552 .. seealso:: `nvmlSystemSetNvlinkBwMode`
22553 """
22554 with nogil:
22555 __status__ = nvmlSystemSetNvlinkBwMode(nvlink_bw_mode)
22556 check_status(__status__)
22559cpdef unsigned int system_get_nvlink_bw_mode() except? 0:
22560 """Get the global nvlink bandwith mode.
22562 Returns:
22563 unsigned int: reference of nvlink bandwidth mode.
22565 .. seealso:: `nvmlSystemGetNvlinkBwMode`
22566 """
22567 cdef unsigned int nvlink_bw_mode
22568 with nogil:
22569 __status__ = nvmlSystemGetNvlinkBwMode(&nvlink_bw_mode)
22570 check_status(__status__)
22571 return nvlink_bw_mode
22574cpdef object device_get_nvlink_supported_bw_modes(intptr_t device):
22575 """Get the supported NvLink Reduced Bandwidth Modes of the device.
22577 Args:
22578 device (intptr_t): The identifier of the target device.
22580 Returns:
22581 nvmlNvlinkSupportedBwModes_v1_t: Reference to ``nvmlNvlinkSupportedBwModes_t``.
22583 .. seealso:: `nvmlDeviceGetNvlinkSupportedBwModes`
22584 """
22585 cdef NvlinkSupportedBwModes_v1 supported_bw_mode_py = NvlinkSupportedBwModes_v1() 1p
22586 cdef nvmlNvlinkSupportedBwModes_t *supported_bw_mode = <nvmlNvlinkSupportedBwModes_t *><intptr_t>(supported_bw_mode_py._get_ptr()) 1p
22587 supported_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSupportedBwModes_v1_t), 1) 1p
22588 with nogil: 1p
22589 __status__ = nvmlDeviceGetNvlinkSupportedBwModes(<Device>device, supported_bw_mode) 1p
22590 check_status(__status__) 1p
22591 return supported_bw_mode_py
22594cpdef object device_get_nvlink_bw_mode(intptr_t device):
22595 """Get the NvLink Reduced Bandwidth Mode for the device.
22597 Args:
22598 device (intptr_t): The identifier of the target device.
22600 Returns:
22601 nvmlNvlinkGetBwMode_v1_t: Reference to ``nvmlNvlinkGetBwMode_t``.
22603 .. seealso:: `nvmlDeviceGetNvlinkBwMode`
22604 """
22605 cdef NvlinkGetBwMode_v1 get_bw_mode_py = NvlinkGetBwMode_v1()
22606 cdef nvmlNvlinkGetBwMode_t *get_bw_mode = <nvmlNvlinkGetBwMode_t *><intptr_t>(get_bw_mode_py._get_ptr())
22607 get_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkGetBwMode_v1_t), 1)
22608 with nogil:
22609 __status__ = nvmlDeviceGetNvlinkBwMode(<Device>device, get_bw_mode)
22610 check_status(__status__)
22611 return get_bw_mode_py
22614cpdef device_set_nvlink_bw_mode(intptr_t device, intptr_t set_bw_mode):
22615 """Set the NvLink Reduced Bandwidth Mode for the device.
22617 Args:
22618 device (intptr_t): The identifier of the target device.
22619 set_bw_mode (intptr_t): Reference to ``nvmlNvlinkSetBwMode_t``.
22621 .. seealso:: `nvmlDeviceSetNvlinkBwMode`
22622 """
22623 set_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSetBwMode_v1_t), 1)
22624 with nogil:
22625 __status__ = nvmlDeviceSetNvlinkBwMode(<Device>device, <nvmlNvlinkSetBwMode_t*>set_bw_mode)
22626 check_status(__status__)
22629cpdef intptr_t event_set_create() except? 0:
22630 """Create an empty set of events. Event set should be freed by ``nvmlEventSetFree``.
22632 Returns:
22633 intptr_t: Reference in which to return the event handle.
22635 .. seealso:: `nvmlEventSetCreate`
22636 """
22637 cdef EventSet set
22638 with nogil: 1h
22639 __status__ = nvmlEventSetCreate(&set) 1h
22640 check_status(__status__) 1h
22641 return <intptr_t>set 1h
22644cpdef device_register_events(intptr_t device, unsigned long long event_types, intptr_t set):
22645 """Starts recording of events on a specified devices and add the events to specified ``nvmlEventSet_t``.
22647 Args:
22648 device (intptr_t): The identifier of the target device.
22649 event_types (unsigned long long): Bitmask of ``Event Types`` to record.
22650 set (intptr_t): Set to which add new event types.
22652 .. seealso:: `nvmlDeviceRegisterEvents`
22653 """
22654 with nogil: 1h
22655 __status__ = nvmlDeviceRegisterEvents(<Device>device, event_types, <EventSet>set) 1h
22656 check_status(__status__) 1h
22659cpdef unsigned long long device_get_supported_event_types(intptr_t device) except? 0:
22660 """Returns information about events supported on device.
22662 Args:
22663 device (intptr_t): The identifier of the target device.
22665 Returns:
22666 unsigned long long: Reference in which to return bitmask of supported events.
22668 .. seealso:: `nvmlDeviceGetSupportedEventTypes`
22669 """
22670 cdef unsigned long long event_types
22671 with nogil: 1h
22672 __status__ = nvmlDeviceGetSupportedEventTypes(<Device>device, &event_types) 1h
22673 check_status(__status__) 1h
22674 return event_types 1h
22677cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms):
22678 """Waits on events and delivers events.
22680 Args:
22681 set (intptr_t): Reference to set of events to wait on.
22682 timeoutms (unsigned int): Maximum amount of wait time in milliseconds for registered event.
22684 Returns:
22685 nvmlEventData_t: Reference in which to return event data.
22687 .. seealso:: `nvmlEventSetWait_v2`
22688 """
22689 cdef EventData data_py = EventData() 1h
22690 cdef nvmlEventData_t *data = <nvmlEventData_t *><intptr_t>(data_py._get_ptr()) 1h
22691 with nogil: 1h
22692 __status__ = nvmlEventSetWait_v2(<EventSet>set, data, timeoutms) 1h
22693 check_status(__status__) 1h
22694 return data_py
22697cpdef event_set_free(intptr_t set):
22698 """Releases events in the set.
22700 Args:
22701 set (intptr_t): Reference to events to be released.
22703 .. seealso:: `nvmlEventSetFree`
22704 """
22705 with nogil: 1h
22706 __status__ = nvmlEventSetFree(<EventSet>set) 1h
22707 check_status(__status__) 1h
22710cpdef device_modify_drain_state(intptr_t pci_info, int new_state):
22711 """Modify the drain state of a GPU. This method forces a GPU to no longer accept new incoming requests. Any new NVML process will no longer see this GPU. Persistence mode for this GPU must be turned off before this call is made. Must be called as administrator. For Linux only.
22713 Args:
22714 pci_info (intptr_t): The PCI address of the GPU drain state to be modified.
22715 new_state (EnableState): The drain state that should be entered, see ``nvmlEnableState_t``.
22717 .. seealso:: `nvmlDeviceModifyDrainState`
22718 """
22719 with nogil:
22720 __status__ = nvmlDeviceModifyDrainState(<nvmlPciInfo_t*>pci_info, <_EnableState>new_state)
22721 check_status(__status__)
22724cpdef int device_query_drain_state(intptr_t pci_info) except? -1:
22725 """Query the drain state of a GPU. This method is used to check if a GPU is in a currently draining state. For Linux only.
22727 Args:
22728 pci_info (intptr_t): The PCI address of the GPU drain state to be queried.
22730 Returns:
22731 int: The current drain state for this GPU, see ``nvmlEnableState_t``.
22733 .. seealso:: `nvmlDeviceQueryDrainState`
22734 """
22735 cdef _EnableState current_state
22736 with nogil:
22737 __status__ = nvmlDeviceQueryDrainState(<nvmlPciInfo_t*>pci_info, ¤t_state)
22738 check_status(__status__)
22739 return <int>current_state
22742cpdef device_remove_gpu_v2(intptr_t pci_info, int gpu_state, int link_state):
22743 """This method will remove the specified GPU from the view of both NVML and the NVIDIA kernel driver as long as no other processes are attached. If other processes are attached, this call will return NVML_ERROR_IN_USE and the GPU will be returned to its original "draining" state. Note: the only situation where a process can still be attached after :func:`device_modify_drain_state` is called to initiate the draining state is if that process was using, and is still using, a GPU before the call was made. Also note, persistence mode counts as an attachment to the GPU thus it must be disabled prior to this call.
22745 Args:
22746 pci_info (intptr_t): The PCI address of the GPU to be removed.
22747 gpu_state (DetachGpuState): Whether the GPU is to be removed, from the OS see ``nvmlDetachGpuState_t``.
22748 link_state (PcieLinkState): Requested upstream PCIe link state, see ``nvmlPcieLinkState_t``.
22750 .. seealso:: `nvmlDeviceRemoveGpu_v2`
22751 """
22752 with nogil:
22753 __status__ = nvmlDeviceRemoveGpu_v2(<nvmlPciInfo_t*>pci_info, <_DetachGpuState>gpu_state, <_PcieLinkState>link_state)
22754 check_status(__status__)
22757cpdef device_discover_gpus(intptr_t pci_info):
22758 """Request the OS and the NVIDIA kernel driver to rediscover a portion of the PCI subsystem looking for GPUs that were previously removed. The portion of the PCI tree can be narrowed by specifying a domain, bus, and device. If all are zeroes then the entire PCI tree will be searched. Please note that for long-running NVML processes the enumeration will change based on how many GPUs are discovered and where they are inserted in bus order.
22760 Args:
22761 pci_info (intptr_t): The PCI tree to be searched. Only the domain, bus, and device fields are used in this call.
22763 .. seealso:: `nvmlDeviceDiscoverGpus`
22764 """
22765 with nogil: 1w
22766 __status__ = nvmlDeviceDiscoverGpus(<nvmlPciInfo_t*>pci_info) 1w
22767 check_status(__status__) 1w
22770cpdef int device_get_virtualization_mode(intptr_t device) except? -1:
22771 """This method is used to get the virtualization mode corresponding to the GPU.
22773 Args:
22774 device (intptr_t): Identifier of the target device.
22776 Returns:
22777 int: Reference to virtualization mode. One of NVML_GPU_VIRTUALIZATION_?.
22779 .. seealso:: `nvmlDeviceGetVirtualizationMode`
22780 """
22781 cdef _GpuVirtualizationMode p_virtual_mode
22782 with nogil: 1GD
22783 __status__ = nvmlDeviceGetVirtualizationMode(<Device>device, &p_virtual_mode) 1GD
22784 check_status(__status__) 1GD
22785 return <int>p_virtual_mode 1GD
22788cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1:
22789 """Queries if SR-IOV host operation is supported on a vGPU supported device.
22791 Args:
22792 device (intptr_t): The identifier of the target device.
22794 Returns:
22795 int: Reference in which to return the current vGPU mode.
22797 .. seealso:: `nvmlDeviceGetHostVgpuMode`
22798 """
22799 cdef _HostVgpuMode p_host_vgpu_mode
22800 with nogil:
22801 __status__ = nvmlDeviceGetHostVgpuMode(<Device>device, &p_host_vgpu_mode)
22802 check_status(__status__)
22803 return <int>p_host_vgpu_mode
22806cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode):
22807 """This method is used to set the virtualization mode corresponding to the GPU.
22809 Args:
22810 device (intptr_t): Identifier of the target device.
22811 virtual_mode (GpuVirtualizationMode): virtualization mode. One of NVML_GPU_VIRTUALIZATION_?.
22813 .. seealso:: `nvmlDeviceSetVirtualizationMode`
22814 """
22815 with nogil:
22816 __status__ = nvmlDeviceSetVirtualizationMode(<Device>device, <_GpuVirtualizationMode>virtual_mode)
22817 check_status(__status__)
22820cpdef unsigned long long vgpu_type_get_gsp_heap_size(unsigned int vgpu_type_id) except? 0:
22821 """Retrieve the static GSP heap size of the vGPU type in bytes.
22823 Args:
22824 vgpu_type_id (unsigned int): Handle to vGPU type.
22826 Returns:
22827 unsigned long long: Reference to return the GSP heap size value.
22829 .. seealso:: `nvmlVgpuTypeGetGspHeapSize`
22830 """
22831 cdef unsigned long long gsp_heap_size
22832 with nogil:
22833 __status__ = nvmlVgpuTypeGetGspHeapSize(<nvmlVgpuTypeId_t>vgpu_type_id, &gsp_heap_size)
22834 check_status(__status__)
22835 return gsp_heap_size
22838cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) except? 0:
22839 """Retrieve the static framebuffer reservation of the vGPU type in bytes.
22841 Args:
22842 vgpu_type_id (unsigned int): Handle to vGPU type.
22844 Returns:
22845 unsigned long long: Reference to return the framebuffer reservation.
22847 .. seealso:: `nvmlVgpuTypeGetFbReservation`
22848 """
22849 cdef unsigned long long fb_reservation
22850 with nogil:
22851 __status__ = nvmlVgpuTypeGetFbReservation(<nvmlVgpuTypeId_t>vgpu_type_id, &fb_reservation)
22852 check_status(__status__)
22853 return fb_reservation
22856cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state):
22857 """Set the desirable vGPU capability of a device.
22859 Args:
22860 device (intptr_t): The identifier of the target device.
22861 capability (DeviceVgpuCapability): Specifies the ``nvmlDeviceVgpuCapability_t`` to be set.
22862 state (EnableState): The target capability mode.
22864 .. seealso:: `nvmlDeviceSetVgpuCapabilities`
22865 """
22866 with nogil:
22867 __status__ = nvmlDeviceSetVgpuCapabilities(<Device>device, <_DeviceVgpuCapability>capability, <_EnableState>state)
22868 check_status(__status__)
22871cpdef object device_get_grid_licensable_features_v4(intptr_t device):
22872 """Retrieve the vGPU Software licensable features.
22874 Args:
22875 device (intptr_t): Identifier of the target device.
22877 Returns:
22878 nvmlGridLicensableFeatures_t: Pointer to structure in which vGPU software licensable features are returned.
22880 .. seealso:: `nvmlDeviceGetGridLicensableFeatures_v4`
22881 """
22882 cdef GridLicensableFeatures p_grid_licensable_features_py = GridLicensableFeatures() 1x
22883 cdef nvmlGridLicensableFeatures_t *p_grid_licensable_features = <nvmlGridLicensableFeatures_t *><intptr_t>(p_grid_licensable_features_py._get_ptr()) 1x
22884 with nogil: 1x
22885 __status__ = nvmlDeviceGetGridLicensableFeatures_v4(<Device>device, p_grid_licensable_features) 1x
22886 check_status(__status__) 1x
22887 return p_grid_licensable_features_py 1x
22890cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0:
22891 """Retrieve the requested vGPU driver capability.
22893 Args:
22894 capability (VgpuDriverCapability): Specifies the ``nvmlVgpuDriverCapability_t`` to be queried.
22896 Returns:
22897 unsigned int: A boolean for the queried capability indicating that feature is supported.
22899 .. seealso:: `nvmlGetVgpuDriverCapabilities`
22900 """
22901 cdef unsigned int cap_result
22902 with nogil:
22903 __status__ = nvmlGetVgpuDriverCapabilities(<_VgpuDriverCapability>capability, &cap_result)
22904 check_status(__status__)
22905 return cap_result
22908cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0:
22909 """Retrieve the requested vGPU capability for GPU.
22911 Args:
22912 device (intptr_t): The identifier of the target device.
22913 capability (DeviceVgpuCapability): Specifies the ``nvmlDeviceVgpuCapability_t`` to be queried.
22915 Returns:
22916 unsigned int: Specifies that the queried capability is supported, and also returns capability's data.
22918 .. seealso:: `nvmlDeviceGetVgpuCapabilities`
22919 """
22920 cdef unsigned int cap_result
22921 with nogil:
22922 __status__ = nvmlDeviceGetVgpuCapabilities(<Device>device, <_DeviceVgpuCapability>capability, &cap_result)
22923 check_status(__status__)
22924 return cap_result
22927cpdef str vgpu_type_get_class(unsigned int vgpu_type_id):
22928 """Retrieve the class of a vGPU type. It will not exceed 64 characters in length (including the NUL terminator). See ``nvmlConstants.NVML_DEVICE_NAME_BUFFER_SIZE``.
22930 Args:
22931 vgpu_type_id (unsigned int): Handle to vGPU type.
22933 .. seealso:: `nvmlVgpuTypeGetClass`
22934 """
22935 cdef unsigned int[1] size = [0]
22936 with nogil:
22937 __status__ = nvmlVgpuTypeGetClass(<nvmlVgpuTypeId_t>vgpu_type_id, NULL, <unsigned int*>size)
22938 check_status_size(__status__)
22939 if size[0] == 0:
22940 return ""
22941 cdef bytes _vgpu_type_class_ = bytes(size[0])
22942 cdef char* vgpu_type_class = _vgpu_type_class_
22943 with nogil:
22944 __status__ = nvmlVgpuTypeGetClass(<nvmlVgpuTypeId_t>vgpu_type_id, vgpu_type_class, <unsigned int*>size)
22945 check_status(__status__)
22946 return cpython.PyUnicode_FromString(vgpu_type_class)
22949cpdef str vgpu_type_get_name(unsigned int vgpu_type_id):
22950 """Retrieve the vGPU type name.
22952 Args:
22953 vgpu_type_id (unsigned int): Handle to vGPU type.
22955 .. seealso:: `nvmlVgpuTypeGetName`
22956 """
22957 cdef unsigned int size = 64
22958 cdef char[64] vgpu_type_name
22959 with nogil:
22960 __status__ = nvmlVgpuTypeGetName(<nvmlVgpuTypeId_t>vgpu_type_id, vgpu_type_name, <unsigned int*>size)
22961 check_status(__status__)
22962 return cpython.PyUnicode_FromString(vgpu_type_name)
22965cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0:
22966 """Retrieve the GPU Instance Profile ID for the given vGPU type ID. The API will return a valid GPU Instance Profile ID for the MIG capable vGPU types, else INVALID_GPU_INSTANCE_PROFILE_ID is returned.
22968 Args:
22969 vgpu_type_id (unsigned int): Handle to vGPU type.
22971 Returns:
22972 unsigned int: GPU Instance Profile ID.
22974 .. seealso:: `nvmlVgpuTypeGetGpuInstanceProfileId`
22975 """
22976 cdef unsigned int gpu_instance_profile_id
22977 with nogil:
22978 __status__ = nvmlVgpuTypeGetGpuInstanceProfileId(<nvmlVgpuTypeId_t>vgpu_type_id, &gpu_instance_profile_id)
22979 check_status(__status__)
22980 return gpu_instance_profile_id
22983cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id):
22984 """Retrieve the device ID of a vGPU type.
22986 Args:
22987 vgpu_type_id (unsigned int): Handle to vGPU type.
22989 Returns:
22990 A 2-tuple containing:
22992 - unsigned long long: Device ID and vendor ID of the device contained in single 32 bit value.
22993 - unsigned long long: Subsystem ID and subsystem vendor ID of the device contained in single 32 bit value.
22995 .. seealso:: `nvmlVgpuTypeGetDeviceID`
22996 """
22997 cdef unsigned long long device_id
22998 cdef unsigned long long subsystem_id
22999 with nogil:
23000 __status__ = nvmlVgpuTypeGetDeviceID(<nvmlVgpuTypeId_t>vgpu_type_id, &device_id, &subsystem_id)
23001 check_status(__status__)
23002 return (device_id, subsystem_id)
23005cpdef unsigned long long vgpu_type_get_framebuffer_size(unsigned int vgpu_type_id) except? 0:
23006 """Retrieve the vGPU framebuffer size in bytes.
23008 Args:
23009 vgpu_type_id (unsigned int): Handle to vGPU type.
23011 Returns:
23012 unsigned long long: Pointer to framebuffer size in bytes.
23014 .. seealso:: `nvmlVgpuTypeGetFramebufferSize`
23015 """
23016 cdef unsigned long long fb_size
23017 with nogil:
23018 __status__ = nvmlVgpuTypeGetFramebufferSize(<nvmlVgpuTypeId_t>vgpu_type_id, &fb_size)
23019 check_status(__status__)
23020 return fb_size
23023cpdef unsigned int vgpu_type_get_num_display_heads(unsigned int vgpu_type_id) except? 0:
23024 """Retrieve count of vGPU's supported display heads.
23026 Args:
23027 vgpu_type_id (unsigned int): Handle to vGPU type.
23029 Returns:
23030 unsigned int: Pointer to number of display heads.
23032 .. seealso:: `nvmlVgpuTypeGetNumDisplayHeads`
23033 """
23034 cdef unsigned int num_display_heads
23035 with nogil:
23036 __status__ = nvmlVgpuTypeGetNumDisplayHeads(<nvmlVgpuTypeId_t>vgpu_type_id, &num_display_heads)
23037 check_status(__status__)
23038 return num_display_heads
23041cpdef tuple vgpu_type_get_resolution(unsigned int vgpu_type_id, unsigned int display_ind_ex):
23042 """Retrieve vGPU display head's maximum supported resolution.
23044 Args:
23045 vgpu_type_id (unsigned int): Handle to vGPU type.
23046 display_ind_ex (unsigned int): Zero-based index of display head.
23048 Returns:
23049 A 2-tuple containing:
23051 - unsigned int: Pointer to maximum number of pixels in X dimension.
23052 - unsigned int: Pointer to maximum number of pixels in Y dimension.
23054 .. seealso:: `nvmlVgpuTypeGetResolution`
23055 """
23056 cdef unsigned int xdim
23057 cdef unsigned int ydim
23058 with nogil:
23059 __status__ = nvmlVgpuTypeGetResolution(<nvmlVgpuTypeId_t>vgpu_type_id, display_ind_ex, &xdim, &ydim)
23060 check_status(__status__)
23061 return (xdim, ydim)
23064cpdef str vgpu_type_get_license(unsigned int vgpu_type_id):
23065 """Retrieve license requirements for a vGPU type.
23067 Args:
23068 vgpu_type_id (unsigned int): Handle to vGPU type.
23070 .. seealso:: `nvmlVgpuTypeGetLicense`
23071 """
23072 cdef unsigned int size = 128
23073 cdef char[128] vgpu_type_license_string
23074 with nogil:
23075 __status__ = nvmlVgpuTypeGetLicense(<nvmlVgpuTypeId_t>vgpu_type_id, vgpu_type_license_string, size)
23076 check_status(__status__)
23077 return cpython.PyUnicode_FromString(vgpu_type_license_string)
23080cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) except? 0:
23081 """Retrieve the static frame rate limit value of the vGPU type.
23083 Args:
23084 vgpu_type_id (unsigned int): Handle to vGPU type.
23086 Returns:
23087 unsigned int: Reference to return the frame rate limit value.
23089 .. seealso:: `nvmlVgpuTypeGetFrameRateLimit`
23090 """
23091 cdef unsigned int frame_rate_limit
23092 with nogil:
23093 __status__ = nvmlVgpuTypeGetFrameRateLimit(<nvmlVgpuTypeId_t>vgpu_type_id, &frame_rate_limit)
23094 check_status(__status__)
23095 return frame_rate_limit
23098cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0:
23099 """Retrieve the maximum number of vGPU instances creatable on a device for given vGPU type.
23101 Args:
23102 device (intptr_t): The identifier of the target device.
23103 vgpu_type_id (unsigned int): Handle to vGPU type.
23105 Returns:
23106 unsigned int: Pointer to get the max number of vGPU instances that can be created on a deicve for given vgpu_type_id.
23108 .. seealso:: `nvmlVgpuTypeGetMaxInstances`
23109 """
23110 cdef unsigned int vgpu_instance_count
23111 with nogil:
23112 __status__ = nvmlVgpuTypeGetMaxInstances(<Device>device, <nvmlVgpuTypeId_t>vgpu_type_id, &vgpu_instance_count)
23113 check_status(__status__)
23114 return vgpu_instance_count
23117cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0:
23118 """Retrieve the maximum number of vGPU instances supported per VM for given vGPU type.
23120 Args:
23121 vgpu_type_id (unsigned int): Handle to vGPU type.
23123 Returns:
23124 unsigned int: Pointer to get the max number of vGPU instances supported per VM for given ``vgpu_type_id``.
23126 .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerVm`
23127 """
23128 cdef unsigned int vgpu_instance_count_per_vm
23129 with nogil:
23130 __status__ = nvmlVgpuTypeGetMaxInstancesPerVm(<nvmlVgpuTypeId_t>vgpu_type_id, &vgpu_instance_count_per_vm)
23131 check_status(__status__)
23132 return vgpu_instance_count_per_vm
23135cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id):
23136 """Retrieve the BAR1 info for given vGPU type.
23138 Args:
23139 vgpu_type_id (unsigned int): Handle to vGPU type.
23141 Returns:
23142 nvmlVgpuTypeBar1Info_v1_t: Pointer to the vGPU type BAR1 information structure ``nvmlVgpuTypeBar1Info_t``.
23144 .. seealso:: `nvmlVgpuTypeGetBAR1Info`
23145 """
23146 cdef VgpuTypeBar1Info_v1 bar1info_py = VgpuTypeBar1Info_v1()
23147 cdef nvmlVgpuTypeBar1Info_t *bar1info = <nvmlVgpuTypeBar1Info_t *><intptr_t>(bar1info_py._get_ptr())
23148 bar1info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeBar1Info_v1_t), 1)
23149 with nogil:
23150 __status__ = nvmlVgpuTypeGetBAR1Info(<nvmlVgpuTypeId_t>vgpu_type_id, bar1info)
23151 check_status(__status__)
23152 return bar1info_py
23155cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance):
23156 """Retrieve the UUID of a vGPU instance.
23158 Args:
23159 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23161 .. seealso:: `nvmlVgpuInstanceGetUUID`
23162 """
23163 cdef unsigned int size = 80
23164 cdef char[80] uuid
23165 with nogil:
23166 __status__ = nvmlVgpuInstanceGetUUID(<nvmlVgpuInstance_t>vgpu_instance, uuid, size)
23167 check_status(__status__)
23168 return cpython.PyUnicode_FromString(uuid)
23171cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance):
23172 """Retrieve the NVIDIA driver version installed in the VM associated with a vGPU.
23174 Args:
23175 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23177 .. seealso:: `nvmlVgpuInstanceGetVmDriverVersion`
23178 """
23179 cdef unsigned int length = 80
23180 cdef char[80] version
23181 with nogil:
23182 __status__ = nvmlVgpuInstanceGetVmDriverVersion(<nvmlVgpuInstance_t>vgpu_instance, version, length)
23183 check_status(__status__)
23184 return cpython.PyUnicode_FromString(version)
23187cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0:
23188 """Retrieve the framebuffer usage in bytes.
23190 Args:
23191 vgpu_instance (unsigned int): The identifier of the target instance.
23193 Returns:
23194 unsigned long long: Pointer to framebuffer usage in bytes.
23196 .. seealso:: `nvmlVgpuInstanceGetFbUsage`
23197 """
23198 cdef unsigned long long fb_usage
23199 with nogil:
23200 __status__ = nvmlVgpuInstanceGetFbUsage(<nvmlVgpuInstance_t>vgpu_instance, &fb_usage)
23201 check_status(__status__)
23202 return fb_usage
23205cpdef unsigned int vgpu_instance_get_license_status(unsigned int vgpu_instance) except? 0:
23206 """[Deprecated].
23208 Args:
23209 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23211 Returns:
23212 unsigned int: Reference to return the licensing status.
23214 .. seealso:: `nvmlVgpuInstanceGetLicenseStatus`
23215 """
23216 cdef unsigned int licensed
23217 with nogil:
23218 __status__ = nvmlVgpuInstanceGetLicenseStatus(<nvmlVgpuInstance_t>vgpu_instance, &licensed)
23219 check_status(__status__)
23220 return licensed
23223cpdef unsigned int vgpu_instance_get_type(unsigned int vgpu_instance) except? 0:
23224 """Retrieve the vGPU type of a vGPU instance.
23226 Args:
23227 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23229 Returns:
23230 unsigned int: Reference to return the vgpuTypeId.
23232 .. seealso:: `nvmlVgpuInstanceGetType`
23233 """
23234 cdef nvmlVgpuTypeId_t vgpu_type_id
23235 with nogil:
23236 __status__ = nvmlVgpuInstanceGetType(<nvmlVgpuInstance_t>vgpu_instance, &vgpu_type_id)
23237 check_status(__status__)
23238 return <unsigned int>vgpu_type_id
23241cpdef unsigned int vgpu_instance_get_frame_rate_limit(unsigned int vgpu_instance) except? 0:
23242 """Retrieve the frame rate limit set for the vGPU instance.
23244 Args:
23245 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23247 Returns:
23248 unsigned int: Reference to return the frame rate limit.
23250 .. seealso:: `nvmlVgpuInstanceGetFrameRateLimit`
23251 """
23252 cdef unsigned int frame_rate_limit
23253 with nogil:
23254 __status__ = nvmlVgpuInstanceGetFrameRateLimit(<nvmlVgpuInstance_t>vgpu_instance, &frame_rate_limit)
23255 check_status(__status__)
23256 return frame_rate_limit
23259cpdef int vgpu_instance_get_ecc_mode(unsigned int vgpu_instance) except? -1:
23260 """Retrieve the current ECC mode of vGPU instance.
23262 Args:
23263 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
23265 Returns:
23266 int: Reference in which to return the current ECC mode.
23268 .. seealso:: `nvmlVgpuInstanceGetEccMode`
23269 """
23270 cdef _EnableState ecc_mode
23271 with nogil:
23272 __status__ = nvmlVgpuInstanceGetEccMode(<nvmlVgpuInstance_t>vgpu_instance, &ecc_mode)
23273 check_status(__status__)
23274 return <int>ecc_mode
23277cpdef unsigned int vgpu_instance_get_encoder_capacity(unsigned int vgpu_instance) except? 0:
23278 """Retrieve the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100.
23280 Args:
23281 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23283 Returns:
23284 unsigned int: Reference to an unsigned int for the encoder capacity.
23286 .. seealso:: `nvmlVgpuInstanceGetEncoderCapacity`
23287 """
23288 cdef unsigned int encoder_capacity
23289 with nogil:
23290 __status__ = nvmlVgpuInstanceGetEncoderCapacity(<nvmlVgpuInstance_t>vgpu_instance, &encoder_capacity)
23291 check_status(__status__)
23292 return encoder_capacity
23295cpdef vgpu_instance_set_encoder_capacity(unsigned int vgpu_instance, unsigned int encoder_capacity):
23296 """Set the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100.
23298 Args:
23299 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23300 encoder_capacity (unsigned int): Unsigned int for the encoder capacity value.
23302 .. seealso:: `nvmlVgpuInstanceSetEncoderCapacity`
23303 """
23304 with nogil:
23305 __status__ = nvmlVgpuInstanceSetEncoderCapacity(<nvmlVgpuInstance_t>vgpu_instance, encoder_capacity)
23306 check_status(__status__)
23309cpdef tuple vgpu_instance_get_encoder_stats(unsigned int vgpu_instance):
23310 """Retrieves the current encoder statistics of a vGPU Instance.
23312 Args:
23313 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23315 Returns:
23316 A 3-tuple containing:
23318 - unsigned int: Reference to an unsigned int for count of active encoder sessions.
23319 - unsigned int: Reference to an unsigned int for trailing average FPS of all active sessions.
23320 - unsigned int: Reference to an unsigned int for encode latency in microseconds.
23322 .. seealso:: `nvmlVgpuInstanceGetEncoderStats`
23323 """
23324 cdef unsigned int session_count
23325 cdef unsigned int average_fps
23326 cdef unsigned int average_latency
23327 with nogil:
23328 __status__ = nvmlVgpuInstanceGetEncoderStats(<nvmlVgpuInstance_t>vgpu_instance, &session_count, &average_fps, &average_latency)
23329 check_status(__status__)
23330 return (session_count, average_fps, average_latency)
23333cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance):
23334 """Retrieves information about all active encoder sessions on a vGPU Instance.
23336 Args:
23337 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23339 .. seealso:: `nvmlVgpuInstanceGetEncoderSessions`
23340 """
23341 cdef unsigned int[1] session_count = [0]
23342 with nogil:
23343 __status__ = nvmlVgpuInstanceGetEncoderSessions(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>session_count, NULL)
23344 check_status_size(__status__)
23345 cdef EncoderSessionInfo session_info = EncoderSessionInfo(session_count[0])
23346 cdef nvmlEncoderSessionInfo_t *session_info_ptr = <nvmlEncoderSessionInfo_t *><intptr_t>(session_info._get_ptr())
23347 if session_count[0] == 0:
23348 return session_info
23349 with nogil:
23350 __status__ = nvmlVgpuInstanceGetEncoderSessions(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>session_count, session_info_ptr)
23351 check_status(__status__)
23352 return session_info
23355cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance):
23356 """Retrieves the active frame buffer capture sessions statistics of a vGPU Instance.
23358 Args:
23359 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23361 Returns:
23362 nvmlFBCStats_t: Reference to nvmlFBCStats_t structure containing NvFBC stats.
23364 .. seealso:: `nvmlVgpuInstanceGetFBCStats`
23365 """
23366 cdef FBCStats fbc_stats_py = FBCStats()
23367 cdef nvmlFBCStats_t *fbc_stats = <nvmlFBCStats_t *><intptr_t>(fbc_stats_py._get_ptr())
23368 with nogil:
23369 __status__ = nvmlVgpuInstanceGetFBCStats(<nvmlVgpuInstance_t>vgpu_instance, fbc_stats)
23370 check_status(__status__)
23371 return fbc_stats_py
23374cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance):
23375 """Retrieves information about active frame buffer capture sessions on a vGPU Instance.
23377 Args:
23378 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23380 .. seealso:: `nvmlVgpuInstanceGetFBCSessions`
23381 """
23382 cdef unsigned int[1] session_count = [0]
23383 with nogil:
23384 __status__ = nvmlVgpuInstanceGetFBCSessions(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>session_count, NULL)
23385 check_status_size(__status__)
23386 cdef FBCSessionInfo session_info = FBCSessionInfo(session_count[0])
23387 cdef nvmlFBCSessionInfo_t *session_info_ptr = <nvmlFBCSessionInfo_t *><intptr_t>(session_info._get_ptr())
23388 if session_count[0] == 0:
23389 return session_info
23390 with nogil:
23391 __status__ = nvmlVgpuInstanceGetFBCSessions(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>session_count, session_info_ptr)
23392 check_status(__status__)
23393 return session_info
23396cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) except? 0:
23397 """Retrieve the GPU Instance ID for the given vGPU Instance. The API will return a valid GPU Instance ID for MIG backed vGPU Instance, else INVALID_GPU_INSTANCE_ID is returned.
23399 Args:
23400 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23402 Returns:
23403 unsigned int: GPU Instance ID.
23405 .. seealso:: `nvmlVgpuInstanceGetGpuInstanceId`
23406 """
23407 cdef unsigned int gpu_instance_id
23408 with nogil:
23409 __status__ = nvmlVgpuInstanceGetGpuInstanceId(<nvmlVgpuInstance_t>vgpu_instance, &gpu_instance_id)
23410 check_status(__status__)
23411 return gpu_instance_id
23414cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance):
23415 """Retrieves the PCI Id of the given vGPU Instance i.e. the PCI Id of the GPU as seen inside the VM.
23417 Args:
23418 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23420 .. seealso:: `nvmlVgpuInstanceGetGpuPciId`
23421 """
23422 cdef unsigned int[1] length = [0]
23423 with nogil:
23424 __status__ = nvmlVgpuInstanceGetGpuPciId(<nvmlVgpuInstance_t>vgpu_instance, NULL, <unsigned int*>length)
23425 check_status_size(__status__)
23426 if length[0] == 0:
23427 return ""
23428 cdef bytes _vgpu_pci_id_ = bytes(length[0])
23429 cdef char* vgpu_pci_id = _vgpu_pci_id_
23430 with nogil:
23431 __status__ = nvmlVgpuInstanceGetGpuPciId(<nvmlVgpuInstance_t>vgpu_instance, vgpu_pci_id, <unsigned int*>length)
23432 check_status(__status__)
23433 return cpython.PyUnicode_FromString(vgpu_pci_id)
23436cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int capability) except? 0:
23437 """Retrieve the requested capability for a given vGPU type. Refer to the ``nvmlVgpuCapability_t`` structure for the specific capabilities that can be queried. The return value in ``capResult`` should be treated as a boolean, with a non-zero value indicating that the capability is supported.
23439 Args:
23440 vgpu_type_id (unsigned int): Handle to vGPU type.
23441 capability (VgpuCapability): Specifies the ``nvmlVgpuCapability_t`` to be queried.
23443 Returns:
23444 unsigned int: A boolean for the queried capability indicating that feature is supported.
23446 .. seealso:: `nvmlVgpuTypeGetCapabilities`
23447 """
23448 cdef unsigned int cap_result
23449 with nogil:
23450 __status__ = nvmlVgpuTypeGetCapabilities(<nvmlVgpuTypeId_t>vgpu_type_id, <_VgpuCapability>capability, &cap_result)
23451 check_status(__status__)
23452 return cap_result
23455cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance):
23456 """Retrieve the MDEV UUID of a vGPU instance.
23458 Args:
23459 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23461 .. seealso:: `nvmlVgpuInstanceGetMdevUUID`
23462 """
23463 cdef unsigned int size = 80
23464 cdef char[80] mdev_uuid
23465 with nogil:
23466 __status__ = nvmlVgpuInstanceGetMdevUUID(<nvmlVgpuInstance_t>vgpu_instance, mdev_uuid, size)
23467 check_status(__status__)
23468 return cpython.PyUnicode_FromString(mdev_uuid)
23471cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler):
23472 """Set vGPU scheduler state for the given GPU instance.
23474 Args:
23475 gpu_instance (intptr_t): The GPU instance handle.
23476 p_scheduler (intptr_t): Pointer to the caller-provided structure of nvmlVgpuSchedulerState_t.
23478 .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState`
23479 """
23480 (<nvmlVgpuSchedulerState_t*>p_scheduler).version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1)
23481 with nogil:
23482 __status__ = nvmlGpuInstanceSetVgpuSchedulerState(<GpuInstance>gpu_instance, <nvmlVgpuSchedulerState_t*>p_scheduler)
23483 check_status(__status__)
23486cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance):
23487 """Returns the vGPU scheduler state for the given GPU instance. The information returned in ``nvmlVgpuSchedulerStateInfo_t`` is not relevant if the BEST EFFORT policy is set.
23489 Args:
23490 gpu_instance (intptr_t): The GPU instance handle.
23492 Returns:
23493 nvmlVgpuSchedulerStateInfo_v1_t: Reference in which ``pSchedulerStateInfo`` is returned.
23495 .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerState`
23496 """
23497 cdef VgpuSchedulerStateInfo_v1 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v1()
23498 cdef nvmlVgpuSchedulerStateInfo_t *p_scheduler_state_info = <nvmlVgpuSchedulerStateInfo_t *><intptr_t>(p_scheduler_state_info_py._get_ptr())
23499 p_scheduler_state_info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1)
23500 with nogil:
23501 __status__ = nvmlGpuInstanceGetVgpuSchedulerState(<GpuInstance>gpu_instance, p_scheduler_state_info)
23502 check_status(__status__)
23503 return p_scheduler_state_info_py
23506cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance):
23507 """Returns the vGPU scheduler logs for the given GPU instance. ``pSchedulerLogInfo`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``.
23509 Args:
23510 gpu_instance (intptr_t): The GPU instance handle.
23512 Returns:
23513 nvmlVgpuSchedulerLogInfo_v1_t: Reference in which ``pSchedulerLogInfo`` is written.
23515 .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerLog`
23516 """
23517 cdef VgpuSchedulerLogInfo_v1 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v1()
23518 cdef nvmlVgpuSchedulerLogInfo_t *p_scheduler_log_info = <nvmlVgpuSchedulerLogInfo_t *><intptr_t>(p_scheduler_log_info_py._get_ptr())
23519 p_scheduler_log_info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerLogInfo_v1_t), 1)
23520 with nogil:
23521 __status__ = nvmlGpuInstanceGetVgpuSchedulerLog(<GpuInstance>gpu_instance, p_scheduler_log_info)
23522 check_status(__status__)
23523 return p_scheduler_log_info_py
23526cpdef str device_get_pgpu_metadata_string(intptr_t device):
23527 """Returns the properties of the physical GPU indicated by the device in an ascii-encoded string format.
23529 Args:
23530 device (intptr_t): The identifier of the target device.
23532 .. seealso:: `nvmlDeviceGetPgpuMetadataString`
23533 """
23534 cdef unsigned int[1] buffer_size = [0]
23535 with nogil:
23536 __status__ = nvmlDeviceGetPgpuMetadataString(<Device>device, NULL, <unsigned int*>buffer_size)
23537 check_status_size(__status__)
23538 if buffer_size[0] == 0:
23539 return ""
23540 cdef bytes _pgpu_metadata_ = bytes(buffer_size[0])
23541 cdef char* pgpu_metadata = _pgpu_metadata_
23542 with nogil:
23543 __status__ = nvmlDeviceGetPgpuMetadataString(<Device>device, pgpu_metadata, <unsigned int*>buffer_size)
23544 check_status(__status__)
23545 return cpython.PyUnicode_FromString(pgpu_metadata)
23548cpdef object device_get_vgpu_scheduler_log(intptr_t device):
23549 """Returns the vGPU Software scheduler logs. ``pSchedulerLog`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``.
23551 Args:
23552 device (intptr_t): The identifier of the target ``device``.
23554 Returns:
23555 nvmlVgpuSchedulerLog_t: Reference in which ``pSchedulerLog`` is written.
23557 .. seealso:: `nvmlDeviceGetVgpuSchedulerLog`
23558 """
23559 cdef VgpuSchedulerLog p_scheduler_log_py = VgpuSchedulerLog()
23560 cdef nvmlVgpuSchedulerLog_t *p_scheduler_log = <nvmlVgpuSchedulerLog_t *><intptr_t>(p_scheduler_log_py._get_ptr())
23561 with nogil:
23562 __status__ = nvmlDeviceGetVgpuSchedulerLog(<Device>device, p_scheduler_log)
23563 check_status(__status__)
23564 return p_scheduler_log_py
23567cpdef object device_get_vgpu_scheduler_state(intptr_t device):
23568 """Returns the vGPU scheduler state. The information returned in ``nvmlVgpuSchedulerGetState_t`` is not relevant if the BEST EFFORT policy is set.
23570 Args:
23571 device (intptr_t): The identifier of the target ``device``.
23573 Returns:
23574 nvmlVgpuSchedulerGetState_t: Reference in which ``pSchedulerState`` is returned.
23576 .. seealso:: `nvmlDeviceGetVgpuSchedulerState`
23577 """
23578 cdef VgpuSchedulerGetState p_scheduler_state_py = VgpuSchedulerGetState()
23579 cdef nvmlVgpuSchedulerGetState_t *p_scheduler_state = <nvmlVgpuSchedulerGetState_t *><intptr_t>(p_scheduler_state_py._get_ptr())
23580 with nogil:
23581 __status__ = nvmlDeviceGetVgpuSchedulerState(<Device>device, p_scheduler_state)
23582 check_status(__status__)
23583 return p_scheduler_state_py
23586cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device):
23587 """Returns the vGPU scheduler capabilities. The list of supported vGPU schedulers returned in ``nvmlVgpuSchedulerCapabilities_t`` is from the NVML_VGPU_SCHEDULER_POLICY_*. This list enumerates the supported scheduler policies if the engine is Graphics type. The other values in ``nvmlVgpuSchedulerCapabilities_t`` are also applicable if the engine is Graphics type. For other engine types, it is BEST EFFORT policy. If ARR is supported and enabled, scheduling frequency and averaging factor are applicable else timeSlice is applicable.
23589 Args:
23590 device (intptr_t): The identifier of the target ``device``.
23592 Returns:
23593 nvmlVgpuSchedulerCapabilities_t: Reference in which ``pCapabilities`` is written.
23595 .. seealso:: `nvmlDeviceGetVgpuSchedulerCapabilities`
23596 """
23597 cdef VgpuSchedulerCapabilities p_capabilities_py = VgpuSchedulerCapabilities()
23598 cdef nvmlVgpuSchedulerCapabilities_t *p_capabilities = <nvmlVgpuSchedulerCapabilities_t *><intptr_t>(p_capabilities_py._get_ptr())
23599 with nogil:
23600 __status__ = nvmlDeviceGetVgpuSchedulerCapabilities(<Device>device, p_capabilities)
23601 check_status(__status__)
23602 return p_capabilities_py
23605cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state):
23606 """Sets the vGPU scheduler state.
23608 Args:
23609 device (intptr_t): The identifier of the target ``device``.
23610 p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to set.
23612 .. seealso:: `nvmlDeviceSetVgpuSchedulerState`
23613 """
23614 with nogil:
23615 __status__ = nvmlDeviceSetVgpuSchedulerState(<Device>device, <nvmlVgpuSchedulerSetState_t*>p_scheduler_state)
23616 check_status(__status__)
23619cpdef set_vgpu_version(intptr_t vgpu_version):
23620 """Override the preset range of vGPU versions supported by the NVIDIA vGPU Manager with a range set by an administrator.
23622 Args:
23623 vgpu_version (intptr_t): Pointer to a caller-supplied range of supported vGPU versions.
23625 .. seealso:: `nvmlSetVgpuVersion`
23626 """
23627 with nogil:
23628 __status__ = nvmlSetVgpuVersion(<nvmlVgpuVersion_t*>vgpu_version)
23629 check_status(__status__)
23632cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp):
23633 """Retrieves current utilization for processes running on vGPUs on a physical GPU (device).
23635 Args:
23636 device (intptr_t): The identifier for the target device.
23637 last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp.
23639 Returns:
23640 A 2-tuple containing:
23642 - unsigned int: Pointer to caller-supplied array size, and returns number of processes running on vGPU instances.
23643 - nvmlVgpuProcessUtilizationSample_t: Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned.
23645 .. seealso:: `nvmlDeviceGetVgpuProcessUtilization`
23646 """
23647 cdef unsigned int vgpu_process_samples_count
23648 cdef nvmlVgpuProcessUtilizationSample_t utilization_samples
23649 with nogil:
23650 __status__ = nvmlDeviceGetVgpuProcessUtilization(<Device>device, last_seen_time_stamp, &vgpu_process_samples_count, &utilization_samples)
23651 check_status(__status__)
23652 return (vgpu_process_samples_count, utilization_samples)
23655cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1:
23656 """Queries the state of per process accounting mode on vGPU.
23658 Args:
23659 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
23661 Returns:
23662 int: Reference in which to return the current accounting mode.
23664 .. seealso:: `nvmlVgpuInstanceGetAccountingMode`
23665 """
23666 cdef _EnableState mode
23667 with nogil:
23668 __status__ = nvmlVgpuInstanceGetAccountingMode(<nvmlVgpuInstance_t>vgpu_instance, &mode)
23669 check_status(__status__)
23670 return <int>mode
23673cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance):
23674 """Queries list of processes running on vGPU that can be queried for accounting stats. The list of processes returned can be in running or terminated state.
23676 Args:
23677 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
23679 .. seealso:: `nvmlVgpuInstanceGetAccountingPids`
23680 """
23681 cdef unsigned int[1] count = [0]
23682 with nogil:
23683 __status__ = nvmlVgpuInstanceGetAccountingPids(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>count, NULL)
23684 check_status_size(__status__)
23685 if count[0] == 0:
23686 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
23687 cdef view.array pids = view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
23688 cdef unsigned int *pids_ptr = <unsigned int *>(pids.data)
23689 with nogil:
23690 __status__ = nvmlVgpuInstanceGetAccountingPids(<nvmlVgpuInstance_t>vgpu_instance, <unsigned int*>count, pids_ptr)
23691 check_status(__status__)
23692 return pids
23695cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid):
23696 """Queries process's accounting stats.
23698 Args:
23699 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
23700 pid (unsigned int): Process Id of the target process to query stats for.
23702 Returns:
23703 nvmlAccountingStats_t: Reference in which to return the process's accounting stats.
23705 .. seealso:: `nvmlVgpuInstanceGetAccountingStats`
23706 """
23707 cdef AccountingStats stats_py = AccountingStats()
23708 cdef nvmlAccountingStats_t *stats = <nvmlAccountingStats_t *><intptr_t>(stats_py._get_ptr())
23709 with nogil:
23710 __status__ = nvmlVgpuInstanceGetAccountingStats(<nvmlVgpuInstance_t>vgpu_instance, pid, stats)
23711 check_status(__status__)
23712 return stats_py
23715cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance):
23716 """Clears accounting information of the vGPU instance that have already terminated.
23718 Args:
23719 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
23721 .. seealso:: `nvmlVgpuInstanceClearAccountingPids`
23722 """
23723 with nogil:
23724 __status__ = nvmlVgpuInstanceClearAccountingPids(<nvmlVgpuInstance_t>vgpu_instance)
23725 check_status(__status__)
23728cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance):
23729 """Query the license information of the vGPU instance.
23731 Args:
23732 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
23734 Returns:
23735 nvmlVgpuLicenseInfo_t: Pointer to vGPU license information structure.
23737 .. seealso:: `nvmlVgpuInstanceGetLicenseInfo_v2`
23738 """
23739 cdef VgpuLicenseInfo license_info_py = VgpuLicenseInfo()
23740 cdef nvmlVgpuLicenseInfo_t *license_info = <nvmlVgpuLicenseInfo_t *><intptr_t>(license_info_py._get_ptr())
23741 with nogil:
23742 __status__ = nvmlVgpuInstanceGetLicenseInfo_v2(<nvmlVgpuInstance_t>vgpu_instance, license_info)
23743 check_status(__status__)
23744 return license_info_py
23747cpdef unsigned int get_excluded_device_count() except? 0:
23748 """Retrieves the number of excluded GPU devices in the system.
23750 Returns:
23751 unsigned int: Reference in which to return the number of excluded devices.
23753 .. seealso:: `nvmlGetExcludedDeviceCount`
23754 """
23755 cdef unsigned int device_count
23756 with nogil:
23757 __status__ = nvmlGetExcludedDeviceCount(&device_count)
23758 check_status(__status__)
23759 return device_count
23762cpdef object get_excluded_device_info_by_index(unsigned int ind_ex):
23763 """Acquire the device information for an excluded GPU device, based on its ind_ex.
23765 Args:
23766 ind_ex (unsigned int): The ind_ex of the target GPU, >= 0 and < ``deviceCount``.
23768 Returns:
23769 nvmlExcludedDeviceInfo_t: Reference in which to return the device information.
23771 .. seealso:: `nvmlGetExcludedDeviceInfoByIndex`
23772 """
23773 cdef ExcludedDeviceInfo info_py = ExcludedDeviceInfo()
23774 cdef nvmlExcludedDeviceInfo_t *info = <nvmlExcludedDeviceInfo_t *><intptr_t>(info_py._get_ptr())
23775 with nogil:
23776 __status__ = nvmlGetExcludedDeviceInfoByIndex(ind_ex, info)
23777 check_status(__status__)
23778 return info_py
23781cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1:
23782 """Set MIG mode for the device.
23784 Args:
23785 device (intptr_t): The identifier of the target device.
23786 mode (unsigned int): The mode to be set, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``.
23788 Returns:
23789 int: The activationStatus status.
23791 .. seealso:: `nvmlDeviceSetMigMode`
23792 """
23793 cdef _Return activation_status
23794 with nogil:
23795 __status__ = nvmlDeviceSetMigMode(<Device>device, mode, &activation_status)
23796 check_status(__status__)
23797 return <int>activation_status
23800cpdef tuple device_get_mig_mode(intptr_t device):
23801 """Get MIG mode for the device.
23803 Args:
23804 device (intptr_t): The identifier of the target device.
23806 Returns:
23807 A 2-tuple containing:
23809 - unsigned int: Returns the current mode, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``.
23810 - unsigned int: Returns the pending mode, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``.
23812 .. seealso:: `nvmlDeviceGetMigMode`
23813 """
23814 cdef unsigned int current_mode
23815 cdef unsigned int pending_mode
23816 with nogil:
23817 __status__ = nvmlDeviceGetMigMode(<Device>device, ¤t_mode, &pending_mode)
23818 check_status(__status__)
23819 return (current_mode, pending_mode)
23822cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id):
23823 """Get GPU instance placements.
23825 Args:
23826 device (intptr_t): The identifier of the target device.
23827 profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``.
23829 .. seealso:: `nvmlDeviceGetGpuInstancePossiblePlacements_v2`
23830 """
23831 cdef unsigned int[1] count = [0]
23832 with nogil:
23833 __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(<Device>device, profile_id, NULL, <unsigned int*>count)
23834 check_status_size(__status__)
23835 cdef GpuInstancePlacement placements = GpuInstancePlacement(count[0])
23836 cdef nvmlGpuInstancePlacement_t *placements_ptr = <nvmlGpuInstancePlacement_t *><intptr_t>(placements._get_ptr())
23837 if count[0] == 0:
23838 return placements
23839 with nogil:
23840 __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(<Device>device, profile_id, placements_ptr, <unsigned int*>count)
23841 check_status(__status__)
23842 return placements
23845cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0:
23846 """Get GPU instance profile capacity.
23848 Args:
23849 device (intptr_t): The identifier of the target device.
23850 profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``.
23852 Returns:
23853 unsigned int: Returns remaining instance count for the profile ID.
23855 .. seealso:: `nvmlDeviceGetGpuInstanceRemainingCapacity`
23856 """
23857 cdef unsigned int count
23858 with nogil:
23859 __status__ = nvmlDeviceGetGpuInstanceRemainingCapacity(<Device>device, profile_id, &count)
23860 check_status(__status__)
23861 return count
23864cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0:
23865 """Create GPU instance.
23867 Args:
23868 device (intptr_t): The identifier of the target device.
23869 profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``.
23871 Returns:
23872 intptr_t: Returns the GPU instance handle.
23874 .. seealso:: `nvmlDeviceCreateGpuInstance`
23875 """
23876 cdef GpuInstance gpu_instance
23877 with nogil:
23878 __status__ = nvmlDeviceCreateGpuInstance(<Device>device, profile_id, &gpu_instance)
23879 check_status(__status__)
23880 return <intptr_t>gpu_instance
23883cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0:
23884 """Create GPU instance with the specified placement.
23886 Args:
23887 device (intptr_t): The identifier of the target device.
23888 profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``.
23889 placement (intptr_t): The requested placement. See ``nvmlDeviceGetGpuInstancePossiblePlacements_v2``.
23891 Returns:
23892 intptr_t: Returns the GPU instance handle.
23894 .. seealso:: `nvmlDeviceCreateGpuInstanceWithPlacement`
23895 """
23896 cdef GpuInstance gpu_instance
23897 with nogil:
23898 __status__ = nvmlDeviceCreateGpuInstanceWithPlacement(<Device>device, profile_id, <const nvmlGpuInstancePlacement_t*>placement, &gpu_instance)
23899 check_status(__status__)
23900 return <intptr_t>gpu_instance
23903cpdef gpu_instance_destroy(intptr_t gpu_instance):
23904 """Destroy GPU instance.
23906 Args:
23907 gpu_instance (intptr_t): The GPU instance handle.
23909 .. seealso:: `nvmlGpuInstanceDestroy`
23910 """
23911 with nogil:
23912 __status__ = nvmlGpuInstanceDestroy(<GpuInstance>gpu_instance)
23913 check_status(__status__)
23916cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0:
23917 """Get GPU instances for given instance ID.
23919 Args:
23920 device (intptr_t): The identifier of the target device.
23921 id (unsigned int): The GPU instance ID.
23923 Returns:
23924 intptr_t: Returns GPU instance.
23926 .. seealso:: `nvmlDeviceGetGpuInstanceById`
23927 """
23928 cdef GpuInstance gpu_instance
23929 with nogil:
23930 __status__ = nvmlDeviceGetGpuInstanceById(<Device>device, id, &gpu_instance)
23931 check_status(__status__)
23932 return <intptr_t>gpu_instance
23935cpdef object gpu_instance_get_info(intptr_t gpu_instance):
23936 """Get GPU instance information.
23938 Args:
23939 gpu_instance (intptr_t): The GPU instance handle.
23941 Returns:
23942 nvmlGpuInstanceInfo_t: Return GPU instance information.
23944 .. seealso:: `nvmlGpuInstanceGetInfo`
23945 """
23946 cdef GpuInstanceInfo info_py = GpuInstanceInfo()
23947 cdef nvmlGpuInstanceInfo_t *info = <nvmlGpuInstanceInfo_t *><intptr_t>(info_py._get_ptr())
23948 with nogil:
23949 __status__ = nvmlGpuInstanceGetInfo(<GpuInstance>gpu_instance, info)
23950 check_status(__status__)
23951 return info_py
23954cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile):
23955 """Versioned wrapper around ``nvmlGpuInstanceGetComputeInstanceProfileInfo`` that accepts a versioned ``nvmlComputeInstanceProfileInfo_v2_t`` or later output structure.
23957 Args:
23958 gpu_instance (intptr_t): The identifier of the target GPU instance.
23959 profile (unsigned int): One of the NVML_COMPUTE_INSTANCE_PROFILE_*.
23960 eng_profile (unsigned int): One of the NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_*.
23962 Returns:
23963 nvmlComputeInstanceProfileInfo_v2_t: Returns detailed profile information.
23965 .. seealso:: `nvmlGpuInstanceGetComputeInstanceProfileInfoV`
23966 """
23967 cdef ComputeInstanceProfileInfo_v2 info_py = ComputeInstanceProfileInfo_v2()
23968 cdef nvmlComputeInstanceProfileInfo_v2_t *info = <nvmlComputeInstanceProfileInfo_v2_t *><intptr_t>(info_py._get_ptr())
23969 info.version = NVML_VERSION_STRUCT(sizeof(nvmlComputeInstanceProfileInfo_v2_t), 2)
23970 with nogil:
23971 __status__ = nvmlGpuInstanceGetComputeInstanceProfileInfoV(<GpuInstance>gpu_instance, profile, eng_profile, info)
23972 check_status(__status__)
23973 return info_py
23976cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t gpu_instance, unsigned int profile_id) except? 0:
23977 """Get compute instance profile capacity.
23979 Args:
23980 gpu_instance (intptr_t): The identifier of the target GPU instance.
23981 profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``.
23983 Returns:
23984 unsigned int: Returns remaining instance count for the profile ID.
23986 .. seealso:: `nvmlGpuInstanceGetComputeInstanceRemainingCapacity`
23987 """
23988 cdef unsigned int count
23989 with nogil:
23990 __status__ = nvmlGpuInstanceGetComputeInstanceRemainingCapacity(<GpuInstance>gpu_instance, profile_id, &count)
23991 check_status(__status__)
23992 return count
23995cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_instance, unsigned int profile_id):
23996 """Get compute instance placements.
23998 Args:
23999 gpu_instance (intptr_t): The identifier of the target GPU instance.
24000 profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``.
24002 .. seealso:: `nvmlGpuInstanceGetComputeInstancePossiblePlacements`
24003 """
24004 cdef unsigned int[1] count = [0]
24005 with nogil:
24006 __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(<GpuInstance>gpu_instance, profile_id, NULL, <unsigned int*>count)
24007 check_status_size(__status__)
24008 cdef ComputeInstancePlacement placements = ComputeInstancePlacement(count[0])
24009 cdef nvmlComputeInstancePlacement_t *placements_ptr = <nvmlComputeInstancePlacement_t *><intptr_t>(placements._get_ptr())
24010 if count[0] == 0:
24011 return placements
24012 with nogil:
24013 __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(<GpuInstance>gpu_instance, profile_id, placements_ptr, <unsigned int*>count)
24014 check_status(__status__)
24015 return placements
24018cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0:
24019 """Create compute instance.
24021 Args:
24022 gpu_instance (intptr_t): The identifier of the target GPU instance.
24023 profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``.
24025 Returns:
24026 intptr_t: Returns the compute instance handle.
24028 .. seealso:: `nvmlGpuInstanceCreateComputeInstance`
24029 """
24030 cdef ComputeInstance compute_instance
24031 with nogil:
24032 __status__ = nvmlGpuInstanceCreateComputeInstance(<GpuInstance>gpu_instance, profile_id, &compute_instance)
24033 check_status(__status__)
24034 return <intptr_t>compute_instance
24037cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0:
24038 """Create compute instance with the specified placement.
24040 Args:
24041 gpu_instance (intptr_t): The identifier of the target GPU instance.
24042 profile_id (unsigned int): The compute instance profile ID. See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``.
24043 placement (intptr_t): The requested placement. See ``nvmlGpuInstanceGetComputeInstancePossiblePlacements``.
24045 Returns:
24046 intptr_t: Returns the compute instance handle.
24048 .. seealso:: `nvmlGpuInstanceCreateComputeInstanceWithPlacement`
24049 """
24050 cdef ComputeInstance compute_instance
24051 with nogil:
24052 __status__ = nvmlGpuInstanceCreateComputeInstanceWithPlacement(<GpuInstance>gpu_instance, profile_id, <const nvmlComputeInstancePlacement_t*>placement, &compute_instance)
24053 check_status(__status__)
24054 return <intptr_t>compute_instance
24057cpdef compute_instance_destroy(intptr_t compute_instance):
24058 """Destroy compute instance.
24060 Args:
24061 compute_instance (intptr_t): The compute instance handle.
24063 .. seealso:: `nvmlComputeInstanceDestroy`
24064 """
24065 with nogil:
24066 __status__ = nvmlComputeInstanceDestroy(<ComputeInstance>compute_instance)
24067 check_status(__status__)
24070cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0:
24071 """Get compute instance for given instance ID.
24073 Args:
24074 gpu_instance (intptr_t): The identifier of the target GPU instance.
24075 id (unsigned int): The compute instance ID.
24077 Returns:
24078 intptr_t: Returns compute instance.
24080 .. seealso:: `nvmlGpuInstanceGetComputeInstanceById`
24081 """
24082 cdef ComputeInstance compute_instance
24083 with nogil:
24084 __status__ = nvmlGpuInstanceGetComputeInstanceById(<GpuInstance>gpu_instance, id, &compute_instance)
24085 check_status(__status__)
24086 return <intptr_t>compute_instance
24089cpdef object compute_instance_get_info_v2(intptr_t compute_instance):
24090 """Get compute instance information.
24092 Args:
24093 compute_instance (intptr_t): The compute instance handle.
24095 Returns:
24096 nvmlComputeInstanceInfo_t: Return compute instance information.
24098 .. seealso:: `nvmlComputeInstanceGetInfo_v2`
24099 """
24100 cdef ComputeInstanceInfo info_py = ComputeInstanceInfo()
24101 cdef nvmlComputeInstanceInfo_t *info = <nvmlComputeInstanceInfo_t *><intptr_t>(info_py._get_ptr())
24102 with nogil:
24103 __status__ = nvmlComputeInstanceGetInfo_v2(<ComputeInstance>compute_instance, info)
24104 check_status(__status__)
24105 return info_py
24108cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0:
24109 """Test if the given handle refers to a MIG device.
24111 Args:
24112 device (intptr_t): NVML handle to test.
24114 Returns:
24115 unsigned int: True when handle refers to a MIG device.
24117 .. seealso:: `nvmlDeviceIsMigDeviceHandle`
24118 """
24119 cdef unsigned int is_mig_device
24120 with nogil:
24121 __status__ = nvmlDeviceIsMigDeviceHandle(<Device>device, &is_mig_device)
24122 check_status(__status__)
24123 return is_mig_device
24126cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0:
24127 """Get GPU instance ID for the given MIG device handle.
24129 Args:
24130 device (intptr_t): Target MIG device handle.
24132 Returns:
24133 unsigned int: GPU instance ID.
24135 .. seealso:: `nvmlDeviceGetGpuInstanceId`
24136 """
24137 cdef unsigned int id
24138 with nogil:
24139 __status__ = nvmlDeviceGetGpuInstanceId(<Device>device, &id)
24140 check_status(__status__)
24141 return id
24144cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0:
24145 """Get compute instance ID for the given MIG device handle.
24147 Args:
24148 device (intptr_t): Target MIG device handle.
24150 Returns:
24151 unsigned int: Compute instance ID.
24153 .. seealso:: `nvmlDeviceGetComputeInstanceId`
24154 """
24155 cdef unsigned int id
24156 with nogil:
24157 __status__ = nvmlDeviceGetComputeInstanceId(<Device>device, &id)
24158 check_status(__status__)
24159 return id
24162cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0:
24163 """Get the maximum number of MIG devices that can exist under a given parent NVML device.
24165 Args:
24166 device (intptr_t): Target device handle.
24168 Returns:
24169 unsigned int: Count of MIG devices.
24171 .. seealso:: `nvmlDeviceGetMaxMigDeviceCount`
24172 """
24173 cdef unsigned int count
24174 with nogil: 19
24175 __status__ = nvmlDeviceGetMaxMigDeviceCount(<Device>device, &count) 19
24176 check_status(__status__) 19
24177 return count 19
24180cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned int ind_ex) except? 0:
24181 """Get MIG device handle for the given ind_ex under its parent NVML device.
24183 Args:
24184 device (intptr_t): Reference to the parent GPU device handle.
24185 ind_ex (unsigned int): Index of the MIG device.
24187 Returns:
24188 intptr_t: Reference to the MIG device handle.
24190 .. seealso:: `nvmlDeviceGetMigDeviceHandleByIndex`
24191 """
24192 cdef Device mig_device
24193 with nogil:
24194 __status__ = nvmlDeviceGetMigDeviceHandleByIndex(<Device>device, ind_ex, &mig_device)
24195 check_status(__status__)
24196 return <intptr_t>mig_device
24199cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_device) except? 0:
24200 """Get parent device handle from a MIG device handle.
24202 Args:
24203 mig_device (intptr_t): MIG device handle.
24205 Returns:
24206 intptr_t: Device handle.
24208 .. seealso:: `nvmlDeviceGetDeviceHandleFromMigDeviceHandle`
24209 """
24210 cdef Device device
24211 with nogil:
24212 __status__ = nvmlDeviceGetDeviceHandleFromMigDeviceHandle(<Device>mig_device, &device)
24213 check_status(__status__)
24214 return <intptr_t>device
24217cpdef device_power_smoothing_activate_preset_profile(intptr_t device, intptr_t profile):
24218 """Activiate a specific preset profile for datacenter power smoothing. The API only sets the active preset profile based on the input profileId, and ignores the other parameters of the structure. Requires root/admin permissions.
24220 Args:
24221 device (intptr_t): The identifier of the target device.
24222 profile (intptr_t): Reference to ``nvmlPowerSmoothingProfile_v1_t``. Note that only ``profile->profileId`` is used and the rest of the structure is ignored.
24224 .. seealso:: `nvmlDevicePowerSmoothingActivatePresetProfile`
24225 """
24226 with nogil:
24227 __status__ = nvmlDevicePowerSmoothingActivatePresetProfile(<Device>device, <nvmlPowerSmoothingProfile_t*>profile)
24228 check_status(__status__)
24231cpdef device_power_smoothing_update_preset_profile_param(intptr_t device, intptr_t profile):
24232 """Update the value of a specific profile parameter contained within ``nvmlPowerSmoothingProfile_v1_t``. Requires root/admin permissions.
24234 Args:
24235 device (intptr_t): The identifier of the target device.
24236 profile (intptr_t): Reference to ``nvmlPowerSmoothingProfile_v1_t`` struct.
24238 .. seealso:: `nvmlDevicePowerSmoothingUpdatePresetProfileParam`
24239 """
24240 with nogil:
24241 __status__ = nvmlDevicePowerSmoothingUpdatePresetProfileParam(<Device>device, <nvmlPowerSmoothingProfile_t*>profile)
24242 check_status(__status__)
24245cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state):
24246 """Enable or disable the Power Smoothing Feature. Requires root/admin permissions.
24248 Args:
24249 device (intptr_t): The identifier of the target device.
24250 state (intptr_t): Reference to ``nvmlPowerSmoothingState_v1_t``.
24252 .. seealso:: `nvmlDevicePowerSmoothingSetState`
24253 """
24254 with nogil:
24255 __status__ = nvmlDevicePowerSmoothingSetState(<Device>device, <nvmlPowerSmoothingState_t*>state)
24256 check_status(__status__)
24259cpdef object device_get_addressing_mode(intptr_t device):
24260 """Get the addressing mode for a given GPU. Addressing modes can be one of:.
24262 Args:
24263 device (intptr_t): The device handle.
24265 Returns:
24266 nvmlDeviceAddressingMode_v1_t: Pointer to addressing mode of the device.
24268 .. seealso:: `nvmlDeviceGetAddressingMode`
24269 """
24270 cdef DeviceAddressingMode_v1 mode_py = DeviceAddressingMode_v1() 1i
24271 cdef nvmlDeviceAddressingMode_t *mode = <nvmlDeviceAddressingMode_t *><intptr_t>(mode_py._get_ptr()) 1i
24272 mode.version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceAddressingMode_v1_t), 1) 1i
24273 with nogil: 1i
24274 __status__ = nvmlDeviceGetAddressingMode(<Device>device, mode) 1i
24275 check_status(__status__) 1i
24276 return mode_py 1i
24279cpdef object device_get_repair_status(intptr_t device):
24280 """Get the repair status for TPC/Channel repair.
24282 Args:
24283 device (intptr_t): The identifier of the target device.
24285 Returns:
24286 nvmlRepairStatus_v1_t: Reference to ``nvmlRepairStatus_t``.
24288 .. seealso:: `nvmlDeviceGetRepairStatus`
24289 """
24290 cdef RepairStatus_v1 repair_status_py = RepairStatus_v1() 1t
24291 cdef nvmlRepairStatus_t *repair_status = <nvmlRepairStatus_t *><intptr_t>(repair_status_py._get_ptr()) 1t
24292 repair_status.version = NVML_VERSION_STRUCT(sizeof(nvmlRepairStatus_v1_t), 1) 1t
24293 with nogil: 1t
24294 __status__ = nvmlDeviceGetRepairStatus(<Device>device, repair_status) 1t
24295 check_status(__status__) 1t
24296 return repair_status_py 1t
24299cpdef object device_get_power_mizer_mode_v1(intptr_t device):
24300 """Retrieves current power mizer mode on this device.
24302 Args:
24303 device (intptr_t): The identifier of the target device.
24305 Returns:
24306 nvmlDevicePowerMizerModes_v1_t: Reference in which to return the power mizer mode.
24308 .. seealso:: `nvmlDeviceGetPowerMizerMode_v1`
24309 """
24310 cdef DevicePowerMizerModes_v1 power_mizer_mode_py = DevicePowerMizerModes_v1()
24311 cdef nvmlDevicePowerMizerModes_v1_t *power_mizer_mode = <nvmlDevicePowerMizerModes_v1_t *><intptr_t>(power_mizer_mode_py._get_ptr())
24312 with nogil:
24313 __status__ = nvmlDeviceGetPowerMizerMode_v1(<Device>device, power_mizer_mode)
24314 check_status(__status__)
24315 return power_mizer_mode_py
24318cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode):
24319 """Sets the new power mizer mode.
24321 Args:
24322 device (intptr_t): The identifier of the target device.
24323 power_mizer_mode (intptr_t): Reference in which to set the power mizer mode.
24325 .. seealso:: `nvmlDeviceSetPowerMizerMode_v1`
24326 """
24327 with nogil:
24328 __status__ = nvmlDeviceSetPowerMizerMode_v1(<Device>device, <nvmlDevicePowerMizerModes_v1_t*>power_mizer_mode)
24329 check_status(__status__)
24332cpdef object system_get_topology_gpu_set(unsigned int cpuNumber):
24333 """Retrieve the set of GPUs that have a CPU affinity with the given CPU number
24335 Args:
24336 cpuNumber (unsigned int): The CPU number
24338 Returns:
24339 array: An array of device handles for GPUs found with affinity to cpuNumber
24340 """
24341 cdef unsigned int[1] count = [0] 1M
24342 with nogil: 1M
24343 __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, <unsigned int*>count, NULL) 1M
24344 check_status_size(__status__) 1M
24345 if count[0] == 0: 1M
24346 return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0]
24347 cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") 1M
24348 with nogil: 1M
24349 __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, <unsigned int*>count, <nvmlDevice_t *>deviceArray.data) 1M
24350 check_status(__status__) 1M
24351 return deviceArray 1M
24354cpdef str system_get_driver_branch():
24355 """Retrieves the driver branch of the NVIDIA driver installed on the system.
24357 Returns:
24358 str: driver branch.
24359 """
24360 cdef nvmlSystemDriverBranchInfo_t info
24361 # Calculation copied from the macro NVML_STRUCT_VERSION in nvml.h
24362 # Needs to be updated if the version of the nvmlSystemDriverBranchInfo_t
24363 # struct changes in the future.
24364 info.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemDriverBranchInfo_v1_t), 1) 2Rb
24365 cdef unsigned int length = 80 2Rb
24366 with nogil: 2Rb
24367 __status__ = nvmlSystemGetDriverBranch(&info, length) 2Rb
24368 check_status(__status__) 2Rb
24369 return cpython.PyUnicode_FromString(info.branch) 2Rb
24372cpdef object unit_get_devices(intptr_t unit):
24373 """Retrieves the set of GPU devices that are attached to the specified unit.
24375 Args:
24376 unit (Unit): The identifier of the target unit.
24378 Returns:
24379 array: An array of device handles for GPUs attached to the unit.
24380 """
24381 cdef unsigned int[1] deviceCount = [0]
24382 with nogil:
24383 __status__ = nvmlUnitGetDevices(<nvmlUnit_t *>unit, <unsigned int*>deviceCount, NULL)
24384 check_status_size(__status__)
24385 if deviceCount[0] == 0:
24386 return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0]
24387 cdef view.array deviceArray = view.array(shape=(deviceCount[0],), itemsize=sizeof(intptr_t), format="P", mode="c")
24388 with nogil:
24389 __status__ = nvmlUnitGetDevices(<nvmlUnit_t *>unit, <unsigned int*>deviceCount, <nvmlDevice_t *>deviceArray.data)
24390 check_status(__status__)
24391 return deviceArray
24394cpdef object device_get_topology_nearest_gpus(intptr_t device, unsigned int level):
24395 """Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level
24397 Args:
24398 device (Device): The identifier of the first device
24399 level (GpuTopologyLevel): The level to search for other GPUs
24401 Returns:
24402 array: An array of device handles for GPUs found at level
24403 """
24404 cdef unsigned int[1] count = [0] 16
24405 with nogil: 16
24406 __status__ = nvmlDeviceGetTopologyNearestGpus( 16
24407 <Device>device,
24408 <nvmlGpuTopologyLevel_t>level,
24409 count,
24410 NULL
24411 )
24412 check_status_size(__status__) 16
24413 if count[0] == 0: 16
24414 return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] 16
24415 cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c")
24416 with nogil:
24417 __status__ = nvmlDeviceGetTopologyNearestGpus(
24418 <Device>device,
24419 <nvmlGpuTopologyLevel_t>level,
24420 count,
24421 <nvmlDevice_t *>deviceArray.data
24422 )
24423 check_status(__status__)
24424 return deviceArray
24427cpdef int device_get_temperature_v(intptr_t device, nvmlTemperatureSensors_t sensorType):
24428 """Retrieves the current temperature readings (in degrees C) for the given device.
24430 Args:
24431 device (intptr_t): Target device identifier.
24433 Returns:
24434 nvmlTemperature_v1_t: Structure specifying the sensor type (input) and retrieved temperature value (output).
24436 .. seealso:: `nvmlDeviceGetTemperatureV`
24437 """
24438 cdef nvmlTemperature_v1_t[1] temperature
24440 with nogil: 1n
24441 temperature[0].version = NVML_VERSION_STRUCT(sizeof(nvmlTemperature_v1_t), 1) 1n
24442 temperature[0].sensorType = <nvmlTemperatureSensors_t>sensorType 1n
24443 __status__ = nvmlDeviceGetTemperatureV(<Device>device, temperature) 1n
24444 check_status(__status__) 1n
24445 return temperature.temperature 1n
24448cpdef object device_get_supported_performance_states(intptr_t device):
24449 """Get all supported Performance States (P-States) for the device.
24451 Args:
24452 device (Device): The identifier of the target device.
24453 """
24454 cdef int size = 16 # NVML_MAX_GPU_PERF_STATES 1f
24455 cdef view.array pstates = view.array(shape=(size,), itemsize=sizeof(unsigned int), format="I", mode="c") 1f
24457 # The header says "size is the size of the pstates array in bytes".
24458 # The size of an enum in C is implementation-defined, so we multiply by `sizeof(nvmlPstates_t)` here.
24459 with nogil: 1f
24460 __status__ = nvmlDeviceGetSupportedPerformanceStates( 1f
24461 <Device>device,
24462 <nvmlPstates_t *>pstates.data,
24463 size * sizeof(nvmlPstates_t)
24464 )
24465 check_status(__status__) 1f
24466 return pstates 1f
24469cpdef object device_get_running_process_detail_list(intptr_t device, unsigned int mode):
24470 """Get information about running processes on a device for input context
24472 Args:
24473 device (Device): The device handle or MIG handle
24474 mode (unsigned int): The process mode (Compute/Graphics/MPSCompute)
24475 """
24477 cdef ProcessDetailList_v1 plist = ProcessDetailList_v1()
24478 cdef nvmlProcessDetailList_v1_t *ptr = <nvmlProcessDetailList_v1_t *>plist._get_ptr()
24480 # Get size of array
24481 with nogil:
24482 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlProcessDetailList_v1_t), 1)
24483 ptr.mode = mode
24484 ptr.numProcArrayEntries = 0
24485 ptr.procArray = NULL
24486 __status__ = nvmlDeviceGetRunningProcessDetailList(<Device>device, ptr)
24487 check_status_size(__status__)
24489 if ptr.numProcArrayEntries == 0:
24490 return plist
24492 procArray = ProcessDetail_v1(ptr.numProcArrayEntries)
24493 plist.proc_array = procArray
24495 with nogil:
24496 __status__ = nvmlDeviceGetRunningProcessDetailList(<Device>device, ptr)
24497 check_status(__status__)
24498 return plist
24501cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp):
24502 """Gets recent samples for the GPU.
24504 Args:
24505 device (intptr_t): The identifier for the target device.
24506 type (SamplingType): Type of sampling event.
24507 last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp.
24509 .. seealso:: `nvmlDeviceGetSamples`
24510 """
24511 cdef unsigned int[1] sample_count = [0]
24512 cdef unsigned int[1] sample_val_type = [0]
24513 with nogil:
24514 __status__ = nvmlDeviceGetSamples(<Device>device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, <unsigned int*>sample_count, NULL)
24515 check_status_size(__status__)
24516 cdef Sample samples = Sample(sample_count[0])
24517 cdef nvmlSample_t *samples_ptr = <nvmlSample_t *>samples._get_ptr()
24518 if sample_count[0] == 0:
24519 return samples
24520 with nogil:
24521 __status__ = nvmlDeviceGetSamples(<Device>device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, <unsigned int*>sample_count, samples_ptr)
24522 check_status(__status__)
24523 return (sample_val_type[0], samples)
24526cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause):
24527 """Returns the list of retired pages by source, including pages that are pending retirement
24529 Args:
24530 device (Device): The identifier of the target device.
24531 cause (PageRetirementCause): Filter page addresses by cause of retirement.
24533 Returns:
24534 tuple: A tuple of two arrays (addresses, timestamps).
24535 """
24536 cdef unsigned int[1] page_count = [0]
24537 with nogil:
24538 __status__ = nvmlDeviceGetRetiredPages_v2(<Device>device, <_PageRetirementCause>cause, <unsigned int*>page_count, NULL, NULL)
24539 check_status_size(__status__)
24540 if page_count[0] == 0:
24541 return (
24542 view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0],
24543 view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0]
24544 )
24545 cdef view.array addresses = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c")
24546 cdef view.array timestamps = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c")
24547 with nogil:
24548 __status__ = nvmlDeviceGetRetiredPages_v2(<Device>device, <_PageRetirementCause>cause, <unsigned int*>page_count, <unsigned long long *>addresses.data, <unsigned long long *>timestamps.data)
24549 check_status(__status__)
24550 return (addresses, timestamps)
24553cpdef object device_get_processes_utilization_info(intptr_t device, unsigned long long last_seen_time_stamp):
24554 """Retrieves the recent utilization and process ID for all running processes
24556 Args:
24557 device (Device): The identifier of the target device.
24558 last_seen_time_stamp (unsigned long long): Timestamp in microseconds. Set it to 0 to read utilization based
24559 on all the samples maintained by the driver's internal sample buffer. Set to a timeStamp retrieved from
24560 a previous query to read utilization since the previous query.
24562 Returns:
24563 ProcessesUtilizationInfo_v1: The processes utilization information structure.
24564 """
24565 cdef ProcessesUtilizationInfo_v1 procesesUtilInfo = ProcessesUtilizationInfo_v1()
24566 cdef nvmlProcessesUtilizationInfo_t *ptr = <nvmlProcessesUtilizationInfo_v1_t *>procesesUtilInfo._get_ptr()
24568 # Get size of array
24569 with nogil:
24570 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlProcessesUtilizationInfo_v1_t), 1)
24571 ptr.processSamplesCount = 0
24572 ptr.lastSeenTimeStamp = last_seen_time_stamp
24573 ptr.procUtilArray = NULL
24574 __status__ = nvmlDeviceGetProcessesUtilizationInfo(
24575 <nvmlDevice_t>device, ptr
24576 )
24577 check_status_size(__status__)
24579 if ptr.processSamplesCount == 0:
24580 return procesesUtilInfo
24582 cdef ProcessUtilizationInfo_v1 procUtilArray = ProcessUtilizationInfo_v1(ptr.processSamplesCount)
24583 procesesUtilInfo.proc_util_array = procUtilArray
24585 with nogil:
24586 __status__ = nvmlDeviceGetProcessesUtilizationInfo(
24587 <nvmlDevice_t>device, ptr
24588 )
24589 check_status(__status__)
24591 return procesesUtilInfo
24594cpdef device_set_hostname_v1(intptr_t device, str hostname):
24595 """Set the hostname for the device.
24597 Args:
24598 device (Device): The identifier of the target device.
24599 hostname (str): The new hostname to set.
24600 """
24601 cdef bytes = cpython.PyUnicode_AsASCIIString(hostname)
24602 if len(bytes) > 64:
24603 raise ValueError("hostname must 64 characters or less")
24605 cdef nvmlHostname_v1_t hostname_struct
24606 memcpy(<void *>hostname_struct.value, <void *>cpython.PyBytes_AsString(bytes), len(bytes))
24608 with nogil:
24609 __status__ = nvmlDeviceSetHostname_v1(<Device>device, &hostname_struct)
24610 check_status(__status__)
24613cpdef str device_get_hostname_v1(intptr_t device):
24614 """Get the hostname for the device.
24616 Args:
24617 device (Device): The identifier of the target device.
24619 Returns:
24620 str: Hostname of the device.
24621 """
24622 cdef nvmlHostname_v1_t hostname
24623 with nogil:
24624 __status__ = nvmlDeviceGetHostname_v1(<Device>device, &hostname)
24625 check_status(__status__)
24626 return cpython.PyUnicode_FromString(hostname.value)
24629cdef FieldValue _cast_field_values(values):
24630 if isinstance(values, FieldValue): 1od
24631 return values 1o
24632 cdef FieldValue values_
24633 cdef unsigned int valuesCount = len(values) 1od
24634 values_ = FieldValue(valuesCount) 1od
24635 for i, v in enumerate(values): 1od
24636 if isinstance(v, tuple): 1od
24637 if len(v) != 2:
24638 raise ValueError("FieldValue tuple must be of length 2")
24639 if not isinstance(v[0], int) or not isinstance(v[1], int):
24640 raise ValueError("FieldValue tuple elements must be integers")
24641 values_[i].field_id = v[0]
24642 values_[i].scope_id = v[1]
24643 elif isinstance(v, int): 1od
24644 values_[i].field_id = v 1od
24645 else:
24646 raise ValueError("Each entry must be an integer field ID, or a tuple of (field ID, scope ID)")
24647 return values_ 1od
24650cpdef object device_get_field_values(intptr_t device, values):
24651 """Request values for a list of fields for a device. This API allows multiple fields to be queried at once. If any of the underlying fieldIds are populated by the same driver call, the results for those field IDs will be populated from a single call rather than making a driver call for each fieldId.
24653 Args:
24654 device (intptr_t): The device handle of the GPU to request field values for.
24655 values (FieldValue): Array of FieldValue specifying what to retrieve.
24657 .. seealso:: `nvmlDeviceGetFieldValues`
24658 """
24659 cdef FieldValue values_ = _cast_field_values(values) 1od
24660 cdef nvmlFieldValue_t *ptr = <nvmlFieldValue_t *>values_._get_ptr() 1od
24661 cdef unsigned int valuesCount = len(values) 1od
24662 with nogil: 1od
24663 __status__ = nvmlDeviceGetFieldValues(<Device>device, valuesCount, ptr) 1od
24664 check_status(__status__) 1od
24666 values_._data.resize((valuesCount,)) 1od
24667 return values_ 1od
24670cpdef device_clear_field_values(intptr_t device, values):
24671 """Clear values for a list of fields for a device. This API allows multiple fields to be cleared at once.
24673 Args:
24674 device (Device): The device handle of the GPU to request field values for
24675 values (FieldValue): FieldValue instance to hold field values. Each value's fieldId must be populated
24676 prior to this call
24677 """
24678 cdef FieldValue values_ = _cast_field_values(values) 1d
24679 cdef nvmlFieldValue_t *ptr = <nvmlFieldValue_t *>values_._get_ptr() 1d
24680 cdef unsigned int valuesCount = len(values) 1d
24682 with nogil: 1d
24683 __status__ = nvmlDeviceClearFieldValues(<Device>device, valuesCount, ptr) 1d
24684 check_status(__status__) 1d
24687cpdef object device_get_supported_vgpus(intptr_t device):
24688 """Retrieve the supported vGPU types on a physical GPU (device).
24690 Args:
24691 device (Device): The identifier of the target device.
24693 Returns:
24694 array: An array of supported vGPU type IDs.
24695 """
24696 cdef unsigned int[1] vgpuCount = [0]
24697 with nogil:
24698 __status__ = nvmlDeviceGetSupportedVgpus(<Device>device, vgpuCount, NULL)
24699 check_status_size(__status__)
24700 if vgpuCount[0] == 0:
24701 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
24702 cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
24703 with nogil:
24704 __status__ = nvmlDeviceGetSupportedVgpus(<Device>device, vgpuCount, <nvmlVgpuTypeId_t *>vgpuTypeIds.data)
24705 check_status(__status__)
24706 return vgpuTypeIds
24709cpdef object device_get_creatable_vgpus(intptr_t device):
24710 """Retrieve the currently creatable vGPU types on a physical GPU (device).
24712 Args:
24713 device (Device): The identifier of the target device.
24715 Returns:
24716 array: An array of createable vGPU type IDs.
24717 """
24718 cdef unsigned int[1] vgpuCount = [0]
24719 with nogil:
24720 __status__ = nvmlDeviceGetCreatableVgpus(<Device>device, vgpuCount, NULL)
24721 check_status_size(__status__)
24722 if vgpuCount[0] == 0:
24723 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
24724 cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
24725 with nogil:
24726 __status__ = nvmlDeviceGetCreatableVgpus(<Device>device, vgpuCount, <nvmlVgpuTypeId_t *>vgpuTypeIds.data)
24727 check_status(__status__)
24728 return vgpuTypeIds
24731cpdef object device_get_active_vgpus(intptr_t device):
24732 """Retrieve the active vGPU instances on a device.
24734 Args:
24735 device (Device): The identifier of the target device.
24737 Returns:
24738 array: An array of active vGPU instance IDs.
24739 """
24740 cdef unsigned int[1] vgpuCount = [0]
24741 with nogil:
24742 __status__ = nvmlDeviceGetActiveVgpus(<Device>device, vgpuCount, NULL)
24743 check_status_size(__status__)
24744 if vgpuCount[0] == 0:
24745 return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0]
24746 cdef view.array vgpuInstances = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c")
24747 with nogil:
24748 __status__ = nvmlDeviceGetActiveVgpus(<Device>device, vgpuCount, <nvmlVgpuInstance_t *>vgpuInstances.data)
24749 check_status(__status__)
24750 return vgpuInstances
24753cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance):
24754 """Retrieve the VM ID associated with a vGPU instance.
24756 Args:
24757 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
24759 Returns:
24760 tuple[str, VgpuVmIdType]: A tuple of (id, id_type).
24761 """
24762 cdef unsigned int size = 80
24763 cdef char[80] vmId
24764 cdef nvmlVgpuVmIdType_t[1] vmIdType
24765 with nogil:
24766 __status__ = nvmlVgpuInstanceGetVmID(<nvmlVgpuInstance_t>vgpu_instance, vmId, size, vmIdType)
24767 check_status(__status__)
24768 return (cpython.PyUnicode_FromString(vmId), vmIdType[0])
24771cpdef object gpu_instance_get_creatable_vgpus(intptr_t gpu_instance):
24772 """Query the currently creatable vGPU types on a specific GPU Instance.
24774 Args:
24775 gpu_instance (GpuInstance): The identifier of the target GPU Instance.
24777 Returns:
24778 VgpuTypeIdInfo_v1: The vGPU type ID information structure.
24779 """
24781 cdef VgpuTypeIdInfo_v1 pVgpus = VgpuTypeIdInfo_v1()
24782 cdef nvmlVgpuTypeIdInfo_v1_t *ptr = <nvmlVgpuTypeIdInfo_v1_t *>pVgpus._get_ptr()
24784 # Get size of array
24785 with nogil:
24786 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeIdInfo_v1_t), 1)
24787 ptr.vgpuCount = 0
24788 ptr.vgpuTypeIds = NULL
24789 __status__ = nvmlGpuInstanceGetCreatableVgpus(<GpuInstance>gpu_instance, ptr)
24790 check_status_size(__status__)
24792 if ptr.vgpuCount == 0:
24793 return pVgpus
24795 cdef view.array vgpuTypeIds = view.array(shape=(ptr.vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c")
24796 pVgpus.vgpu_type_ids = vgpuTypeIds
24798 with nogil:
24799 __status__ = nvmlGpuInstanceGetCreatableVgpus(<GpuInstance>gpu_instance, ptr)
24800 check_status(__status__)
24802 return pVgpus
24805cpdef object gpu_instance_get_active_vgpus(intptr_t gpu_instance):
24806 """Retrieve the active vGPU instances within a GPU instance.
24808 Args:
24809 gpu_instance (GpuInstance): The identifier of the target GPU Instance.
24811 Returns:
24812 ActiveVgpuInstanceInfo: The vGPU instance ID information structure.
24813 """
24814 cdef ActiveVgpuInstanceInfo_v1 activeVgpuInfo = ActiveVgpuInstanceInfo_v1()
24815 cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr = <nvmlActiveVgpuInstanceInfo_v1_t *>activeVgpuInfo._get_ptr()
24817 with nogil:
24818 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlActiveVgpuInstanceInfo_v1_t), 1)
24819 ptr.vgpuCount = 0
24820 ptr.vgpuInstances = NULL
24821 __status__ = nvmlGpuInstanceGetActiveVgpus(<GpuInstance>gpu_instance, ptr)
24822 check_status_size(__status__)
24824 if ptr.vgpuCount == 0:
24825 return activeVgpuInfo
24827 cdef view.array vgpuInstances = view.array(shape=(ptr.vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c")
24828 activeVgpuInfo.vgpu_instances = vgpuInstances
24830 with nogil:
24831 __status__ = nvmlGpuInstanceGetActiveVgpus(<GpuInstance>gpu_instance, ptr)
24832 check_status(__status__)
24834 return activeVgpuInfo
24837cpdef object gpu_instance_get_vgpu_type_creatable_placements(intptr_t gpu_instance, unsigned int vgpu_type_id):
24838 """Query the creatable vGPU placement ID of the vGPU type within a GPU instance.
24840 Args:
24841 gpu_instance (GpuInstance): The identifier of the target GPU Instance.
24842 vgpu_type_id (unsigned int): The vGPU type ID.
24844 Returns:
24845 VgpuPlacementList_v2: The vGPU placement list structure.
24846 """
24848 cdef VgpuCreatablePlacementInfo_v1 pCreatablePlacementInfo = VgpuCreatablePlacementInfo_v1()
24849 cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr = <nvmlVgpuCreatablePlacementInfo_v1_t *>pCreatablePlacementInfo._get_ptr()
24851 # Get size of array
24852 with nogil:
24853 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), 1)
24854 ptr.count = 0
24855 ptr.placementIds = NULL
24856 ptr.vgpuTypeId = vgpu_type_id
24857 __status__ = nvmlGpuInstanceGetVgpuTypeCreatablePlacements(<GpuInstance>gpu_instance, ptr)
24858 check_status_size(__status__)
24860 if ptr.count == 0:
24861 return pCreatablePlacementInfo
24863 cdef view.array placementIds = view.array(shape=(ptr.count,), itemsize=sizeof(unsigned int), format="I", mode="c")
24864 pCreatablePlacementInfo.placement_ids = placementIds
24866 with nogil:
24867 __status__ = nvmlGpuInstanceGetVgpuTypeCreatablePlacements(<GpuInstance>gpu_instance, ptr)
24868 check_status(__status__)
24870 return pCreatablePlacementInfo
24873cpdef object device_get_vgpu_type_creatable_placements(intptr_t device, unsigned int vgpu_type_id, unsigned int mode):
24874 """Query the creatable vGPU placement ID of the vGPU type within a GPU instance.
24876 Args:
24877 device (Device): The identifier of the target device.
24878 vgpu_type_id (unsigned int): The vGPU type ID.
24879 mode (unsigned int): The placement mode. 0: Heterogeneous, 1: Homogeneous.
24881 Returns:
24882 VgpuPlacementList_v2: The vGPU placement list structure.
24883 """
24885 cdef VgpuPlacementList_v2 pPlacementList = VgpuPlacementList_v2()
24886 cdef nvmlVgpuPlacementList_v2_t *ptr = <nvmlVgpuPlacementList_v2_t *>pPlacementList._get_ptr()
24888 # Get size of array
24889 with nogil:
24890 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementList_v2_t), 2)
24891 ptr.count = 0
24892 ptr.placementIds = NULL
24893 ptr.mode = mode
24894 __status__ = nvmlDeviceGetVgpuTypeCreatablePlacements(<Device>device, <nvmlVgpuTypeId_t>vgpu_type_id, ptr)
24895 check_status_size(__status__)
24897 if ptr.count == 0:
24898 return pPlacementList
24900 cdef view.array placementIds = view.array(shape=(ptr.count,), itemsize=sizeof(unsigned int), format="I", mode="c")
24901 pPlacementList.placement_ids = placementIds
24903 with nogil:
24904 __status__ = nvmlDeviceGetVgpuTypeCreatablePlacements(<Device>device, <nvmlVgpuTypeId_t>vgpu_type_id, ptr)
24905 check_status(__status__)
24907 return pPlacementList
24910cpdef object vgpu_instance_get_metadata(unsigned int vgpu_instance):
24911 """Returns vGPU metadata structure for a running vGPU. The structure contains information about the vGPU and its
24912 associated VM such as the currently installed NVIDIA guest driver version, together with host driver version and
24913 an opaque data section containing internal state.
24915 Args:
24916 vgpu_instance (unsigned int): The identifier of the target vGPU instance.
24918 Returns:
24919 VgpuMetadata: Metadata.
24920 """
24921 cdef VgpuMetadata vgpuMetadata = VgpuMetadata()
24922 cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuMetadata_t)]
24923 cdef nvmlVgpuMetadata_t *ptr = <nvmlVgpuMetadata_t *>vgpuMetadata._get_ptr()
24925 with nogil:
24926 __status__ = nvmlVgpuInstanceGetMetadata(<nvmlVgpuInstance_t>vgpu_instance, ptr, bufferSize)
24927 check_status_size(__status__)
24929 return vgpuMetadata
24932cpdef object device_get_vgpu_metadata(intptr_t device):
24933 """Returns a vGPU metadata structure for the physical GPU indicated by device. The structure contains
24934 information about the GPU and the currently installed NVIDIA host driver version that's controlling it,
24935 together with an opaque data section containing internal state.
24937 Args:
24938 device (Device): The identifier of the target device.
24940 Returns:
24941 VgpuPgpuMetadata: Metadata.
24942 """
24943 cdef VgpuPgpuMetadata pgpuMetadata = VgpuPgpuMetadata()
24944 cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuPgpuMetadata_t)]
24945 cdef nvmlVgpuPgpuMetadata_t *ptr = <nvmlVgpuPgpuMetadata_t *>pgpuMetadata._get_ptr()
24947 with nogil:
24948 __status__ = nvmlDeviceGetVgpuMetadata(<Device>device, ptr, bufferSize)
24949 check_status_size(__status__)
24951 return pgpuMetadata
24954cpdef object get_vgpu_compatibility(VgpuMetadata vgpu_metadata, VgpuPgpuMetadata pgpu_metadata):
24955 """Takes a vGPU instance metadata structure read from vgpu_instance_get_metadata() and a vGPU metadata structure
24956 for a physical GPU read from device_get_vgpu_metadata, and returns compatibility information of the vGPU instance
24957 and the physical GPU.
24959 Args:
24960 vgpu_metadata (VgpuMetadata): The vGPU instance metadata.
24961 pgpu_metadata (VgpuPgpuMetadata): The physical GPU metadata.
24963 Returns:
24964 VgpuPgpuCompatibility: Compatibility information.
24965 """
24966 cdef VgpuPgpuCompatibility compatibilityInfo = VgpuPgpuCompatibility()
24967 cdef nvmlVgpuPgpuCompatibility_t *ptr = <nvmlVgpuPgpuCompatibility_t *>compatibilityInfo._get_ptr()
24968 cdef nvmlVgpuMetadata_t *vgpu_metadata_ptr = <nvmlVgpuMetadata_t *>vgpu_metadata._get_ptr()
24969 cdef nvmlVgpuPgpuMetadata_t *pgpu_metadata_ptr = <nvmlVgpuPgpuMetadata_t *>pgpu_metadata._get_ptr()
24971 with nogil:
24972 __status__ = nvmlGetVgpuCompatibility(vgpu_metadata_ptr, pgpu_metadata_ptr, ptr)
24973 check_status(__status__)
24975 return compatibilityInfo
24978cpdef tuple get_vgpu_version():
24979 """Query the ranges of supported vGPU versions.
24981 Returns:
24982 tuple: A tuple of (VgpuVersion supported, VgpuVersion current).
24983 """
24984 cdef VgpuVersion supported = VgpuVersion()
24985 cdef nvmlVgpuVersion_t *supported_ptr = <nvmlVgpuVersion_t *>supported._get_ptr()
24986 cdef VgpuVersion current = VgpuVersion()
24987 cdef nvmlVgpuVersion_t *current_ptr = <nvmlVgpuVersion_t *>current._get_ptr()
24989 with nogil:
24990 __status__ = nvmlGetVgpuVersion(supported_ptr, current_ptr)
24992 check_status(__status__)
24993 return (supported, current)
24996cpdef object device_get_vgpu_instances_utilization_info(intptr_t device):
24997 """
24998 Retrieves recent utilization for vGPU instances running on a physical GPU (device).
25000 Args:
25001 device (Device): The identifier of the target device.
25003 Returns:
25004 VgpuInstancesUtilizationInfo_v1: The vGPU instances utilization information structure.
25005 """
25006 cdef VgpuInstancesUtilizationInfo_v1 vgpuUtilInfo = VgpuInstancesUtilizationInfo_v1()
25007 cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr = <nvmlVgpuInstancesUtilizationInfo_t *>vgpuUtilInfo._get_ptr()
25009 with nogil:
25010 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), 1)
25011 ptr.vgpuInstanceCount = 0
25012 ptr.vgpuUtilArray = NULL
25013 __status__ = nvmlDeviceGetVgpuInstancesUtilizationInfo(<Device>device, ptr)
25014 check_status_size(__status__)
25016 if ptr.vgpuInstanceCount == 0:
25017 return vgpuUtilInfo
25019 cdef VgpuInstanceUtilizationInfo_v1 vgpuUtilArray = VgpuInstanceUtilizationInfo_v1(ptr.vgpuInstanceCount)
25020 vgpuUtilInfo.vgpu_util_array = vgpuUtilArray
25022 with nogil:
25023 __status__ = nvmlDeviceGetVgpuInstancesUtilizationInfo(<Device>device, ptr)
25024 check_status(__status__)
25026 return vgpuUtilInfo
25029cpdef object device_get_vgpu_processes_utilization_info(intptr_t device, unsigned int last_seen_time_stamp):
25030 """
25031 Retrieves recent utilization for processes running on vGPU instances on a physical GPU (device).
25033 Args:
25034 device (Device): The identifier of the target device.
25036 Returns:
25037 VgpuProcessesUtilizationInfo: The vGPU processes utilization information structure.
25038 """
25039 cdef VgpuProcessesUtilizationInfo_v1 vgpuProcUtilInfo = VgpuProcessesUtilizationInfo_v1()
25040 cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr = <nvmlVgpuProcessesUtilizationInfo_v1_t *>vgpuProcUtilInfo._get_ptr()
25042 with nogil:
25043 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), 1)
25044 ptr.vgpuProcessCount = 0
25045 ptr.vgpuProcUtilArray = NULL
25046 ptr.lastSeenTimeStamp = last_seen_time_stamp
25047 __status__ = nvmlDeviceGetVgpuProcessesUtilizationInfo(<Device>device, ptr)
25048 check_status_size(__status__)
25050 if ptr.vgpuProcessCount == 0:
25051 return vgpuProcUtilInfo
25053 cdef VgpuProcessUtilizationInfo_v1 vgpuProcUtilArray = VgpuProcessUtilizationInfo_v1(ptr.vgpuProcessCount)
25054 vgpuProcUtilInfo.vgpu_proc_util_array = vgpuProcUtilArray
25056 with nogil:
25057 __status__ = nvmlDeviceGetVgpuProcessesUtilizationInfo(<Device>device, ptr)
25058 check_status(__status__)
25060 return vgpuProcUtilInfo
25063cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id):
25064 """Get GPU instances for given profile ID.
25066 Args:
25067 device (Device): The identifier of the target device.
25068 profile_id (unsigned int): The GPU instance profile ID. See device_get_gpu_instance_profile_info().
25070 Returns:
25071 array: An array of GPU instance handles.
25072 """
25073 cdef unsigned int[1] count = [0]
25074 with nogil:
25075 __status__ = nvmlDeviceGetGpuInstances(<Device>device, profile_id, NULL, count)
25076 check_status_size(__status__)
25078 if count[0] == 0:
25079 view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0]
25081 cdef view.array gpuInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c")
25082 with nogil:
25083 __status__ = nvmlDeviceGetGpuInstances(<Device>device, profile_id, <nvmlGpuInstance_t *>gpuInstances.data, count)
25084 check_status(__status__)
25086 return gpuInstances
25089cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned int profile_id):
25090 """Get Compute instances for given profile ID.
25092 Args:
25093 gpu_instance (GpuInstance): The identifier of the target GPU Instance.
25094 profile_id (unsigned int): The Compute instance profile ID.
25096 Returns:
25097 array: An array of Compute instance handles.
25098 """
25099 cdef unsigned int[1] count = [0]
25100 with nogil:
25101 __status__ = nvmlGpuInstanceGetComputeInstances(<GpuInstance>gpu_instance, profile_id, NULL, count)
25102 check_status_size(__status__)
25104 if count[0] == 0:
25105 view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0]
25107 cdef view.array computeInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c")
25108 with nogil:
25109 __status__ = nvmlGpuInstanceGetComputeInstances(<GpuInstance>gpu_instance, profile_id, <nvmlComputeInstance_t *>computeInstances.data, count)
25110 check_status(__status__)
25112 return computeInstances
25115cpdef object device_get_sram_unique_uncorrected_ecc_error_counts(intptr_t device):
25116 """Retrieves the counts of SRAM unique uncorrected ECC errors
25118 Args:
25119 device (Device): The identifier of the target device.
25121 Returns:
25122 EccSramUniqueUncorrectedErrorCounts_v1: The ECC SRAM unique uncorrected error counts structure.
25123 """
25125 cdef EccSramUniqueUncorrectedErrorCounts_v1 errorCounts = EccSramUniqueUncorrectedErrorCounts_v1()
25126 cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr = <nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *>errorCounts._get_ptr()
25128 with nogil:
25129 ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), 1)
25130 ptr.entryCount = 0
25131 ptr.entries = NULL
25132 __status__ = nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(<Device>device, ptr)
25133 check_status_size(__status__)
25135 cdef EccSramUniqueUncorrectedErrorEntry_v1 entries = EccSramUniqueUncorrectedErrorEntry_v1(ptr.entryCount)
25136 errorCounts.entries = entries
25138 if ptr.entryCount == 0:
25139 return errorCounts
25141 with nogil:
25142 __status__ = nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(<Device>device, ptr)
25143 check_status(__status__)
25145 return errorCounts
25148cpdef object device_get_gpu_fabric_info_v(intptr_t device):
25149 """Versioned wrapper around nvmlDeviceGetGpuFabricInfo that accepts a versioned ``nvmlGpuFabricInfo_v2_t`` or later output structure.
25151 Args:
25152 device (intptr_t): The identifier of the target device.
25154 Returns:
25155 nvmlGpuFabricInfo_v3_t: Information about GPU fabric state.
25157 .. seealso:: `nvmlDeviceGetGpuFabricInfoV`
25158 """
25159 cdef GpuFabricInfo_v3 gpu_fabric_info_v3_py
25160 cdef GpuFabricInfo_v2 gpu_fabric_info_v2_py
25161 cdef nvmlGpuFabricInfoV_t *gpu_fabric_info
25162 if CUDA_VERSION >= 13000:
25163 gpu_fabric_info_v3_py = GpuFabricInfo_v3()
25164 gpu_fabric_info = <nvmlGpuFabricInfoV_t *><intptr_t>(gpu_fabric_info_v3_py._get_ptr())
25165 with nogil:
25166 gpu_fabric_info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuFabricInfo_v3_t), 3)
25167 __status__ = nvmlDeviceGetGpuFabricInfoV(<Device>device, gpu_fabric_info)
25168 check_status(__status__)
25169 return gpu_fabric_info_v3_py
25171 else:
25172 gpu_fabric_info_v2_py = GpuFabricInfo_v2()
25173 gpu_fabric_info = <nvmlGpuFabricInfoV_t *><intptr_t>(gpu_fabric_info_v2_py._get_ptr())
25174 with nogil:
25175 gpu_fabric_info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuFabricInfo_v2_t), 2)
25176 __status__ = nvmlDeviceGetGpuFabricInfoV(<Device>device, gpu_fabric_info)
25177 check_status(__status__)
25178 return gpu_fabric_info_v2_py
25181cpdef object device_get_platform_info(intptr_t device):
25182 """Get platform information of this device.
25184 Args:
25185 device (intptr_t): The identifier of the target device.
25187 Returns:
25188 nvmlPlatformInfo_v2_t: Pointer to the caller-provided structure of nvmlPlatformInfo_t.
25190 .. seealso:: `nvmlDeviceGetPlatformInfo`
25191 """
25192 cdef PlatformInfo_v1 platform_info_v1_py
25193 cdef PlatformInfo_v2 platform_info_v2_py
25194 cdef nvmlPlatformInfo_t *platform_info
25196 if CUDA_VERSION >= 13000: 1D
25197 platform_info_v2_py = PlatformInfo_v2() 1D
25198 platform_info = <nvmlPlatformInfo_t *><intptr_t>(platform_info_v2_py._get_ptr()) 1D
25199 with nogil: 1D
25200 platform_info.version = NVML_VERSION_STRUCT(sizeof(nvmlPlatformInfo_v2_t), 2) 1D
25201 __status__ = nvmlDeviceGetPlatformInfo(<Device>device, platform_info) 1D
25202 check_status(__status__) 1D
25203 return platform_info_v2_py 1D
25205 else:
25206 platform_info_v1_py = PlatformInfo_v1()
25207 platform_info = <nvmlPlatformInfo_t *><intptr_t>(platform_info_v1_py._get_ptr())
25208 with nogil:
25209 platform_info.version = NVML_VERSION_STRUCT(sizeof(nvmlPlatformInfo_v1_t), 1)
25210 __status__ = nvmlDeviceGetPlatformInfo(<Device>device, platform_info)
25211 check_status(__status__)
25212 return platform_info_v1_py
25215cpdef object device_get_nvlink_info(intptr_t device):
25216 """Query NVLINK information associated with this device.
25218 Args:
25219 device (intptr_t): The identifier of the target device.
25221 Returns:
25222 nvmlNvLinkInfo_v2_t: Reference to ``nvmlNvLinkInfo_t``.
25224 .. seealso:: `nvmlDeviceGetNvLinkInfo`
25225 """
25226 cdef NvLinkInfo_v1 info_v1_py
25227 cdef NvLinkInfo_v2 info_v2_py
25228 cdef nvmlNvLinkInfo_t *info
25230 if CUDA_VERSION >= 13000:
25231 info_v2_py = NvLinkInfo_v2()
25232 info = <nvmlNvLinkInfo_t *><intptr_t>(info_v2_py._get_ptr())
25233 with nogil:
25234 info.version = NVML_VERSION_STRUCT(sizeof(nvmlNvLinkInfo_v2_t), 2)
25235 __status__ = nvmlDeviceGetNvLinkInfo(<Device>device, info)
25236 check_status(__status__)
25237 return info_v2_py
25239 else:
25240 info_v1_py = NvLinkInfo_v1()
25241 info = <nvmlNvLinkInfo_t *><intptr_t>(info_v1_py._get_ptr())
25242 with nogil:
25243 info.version = NVML_VERSION_STRUCT(sizeof(nvmlNvLinkInfo_v1_t), 1)
25244 __status__ = nvmlDeviceGetNvLinkInfo(<Device>device, info)
25245 check_status(__status__)
25246 return info_v1_py
25249cpdef intptr_t system_event_set_create():
25250 """Create an empty set of system events. Event set should be freed by ``nvmlSystemEventSetFree``."""
25251 cdef nvmlSystemEventSetCreateRequest_v1_t[1] request
25252 with nogil: 1l
25253 request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetCreateRequest_v1_t), 1) 1l
25254 __status__ = nvmlSystemEventSetCreate(<nvmlSystemEventSetCreateRequest_t*>request) 1l
25255 check_status(__status__) 1l
25256 return <intptr_t>(request[0].set) 1l
25259cpdef system_event_set_free(intptr_t event_set):
25260 """Frees an event set."""
25261 cdef nvmlSystemEventSetFreeRequest_v1_t[1] request
25262 request[0].set = <SystemEventSet>event_set 1l
25263 with nogil: 1l
25264 request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetFreeRequest_v1_t), 1) 1l
25265 __status__ = nvmlSystemEventSetFree(<nvmlSystemEventSetFreeRequest_t*>request) 1l
25266 check_status(__status__) 1l
25269cpdef system_register_events(unsigned long long event_types, intptr_t event_set):
25270 """Starts recording of events on system and add the events to specified ``nvmlSystemEventSet_t``.
25272 Args:
25273 event_types (unsigned long long): Bitmask of nvmlSystemEventType_t values representing the events to register.
25274 event_set (intptr_t): The system event set handle.
25275 """
25276 cdef nvmlSystemRegisterEventRequest_v1_t[1] request
25277 with nogil: 1l
25278 request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemRegisterEventRequest_v1_t), 1) 1l
25279 request[0].set = <SystemEventSet>event_set 1l
25280 request[0].eventTypes = event_types 1l
25281 __status__ = nvmlSystemRegisterEvents(<nvmlSystemRegisterEventRequest_t*>request) 1l
25282 check_status(__status__) 1l
25285cpdef object system_event_set_wait(intptr_t event_set, unsigned int timeout_ms, unsigned int buffer_size):
25286 """Waits for events to occur on the system event set.
25288 Args:
25289 event_set (intptr_t): The system event set handle.
25290 timeout_ms (unsigned int): The maximum amount of time in milliseconds to wait for an event.
25291 buffer_size (unsigned int): The size of the event buffer.
25293 Returns:
25294 SystemEvent: The system event that occurred.
25295 """
25296 cdef nvmlSystemEventSetWaitRequest_v1_t[1] request
25297 cdef SystemEventData_v1 event_data = SystemEventData_v1(buffer_size) 1l
25298 request[0].data = <nvmlSystemEventData_v1_t *><intptr_t>(event_data._get_ptr()) 1l
25299 with nogil: 1l
25300 request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetWaitRequest_v1_t), 1) 1l
25301 request[0].timeoutms = timeout_ms 1l
25302 request[0].set = <SystemEventSet>event_set 1l
25303 request[0].dataSize = buffer_size 1l
25304 __status__ = nvmlSystemEventSetWait(<nvmlSystemEventSetWaitRequest_t*>request) 1l
25305 check_status(__status__) 1l
25306 event_data._data.resize((request[0].numEvent,))
25307 return event_data
25310cpdef unsigned int device_get_fan_speed_rpm(intptr_t device, unsigned int fan):
25311 """Retrieves the intended operating speed in rotations per minute (RPM) of the device's specified fan.
25313 Args:
25314 device (intptr_t): The identifier of the target device.
25315 fan (unsigned int): The index of the fan to query.
25317 Returns:
25318 rpm (unsigned int): The fan speed in RPM.
25320 .. seealso:: `nvmlDeviceGetFanSpeedRPM`
25321 """
25322 cdef nvmlFanSpeedInfo_v1_t[1] fan_speed
25323 with nogil:
25324 fan_speed[0].version = NVML_VERSION_STRUCT(sizeof(nvmlFanSpeedInfo_v1_t), 1)
25325 fan_speed[0].fan = fan
25326 __status__ = nvmlDeviceGetFanSpeedRPM(<Device>device, fan_speed)
25327 check_status(__status__)
25328 return fan_speed[0].speed
25331cpdef int device_get_margin_temperature(intptr_t device):
25332 """Retrieves the thermal margin temperature (distance to nearest slowdown threshold).
25334 Args:
25335 device (intptr_t): The identifier of the target device.
25337 Returns:
25338 margin_temperature (int): The margin temperature value.
25340 .. seealso:: `nvmlDeviceGetMarginTemperature`
25341 """
25342 cdef nvmlMarginTemperature_v1_t[1] margin_temp_info
25343 with nogil:
25344 margin_temp_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlMarginTemperature_v1_t), 1)
25345 __status__ = nvmlDeviceGetMarginTemperature(<Device>device, margin_temp_info)
25346 check_status(__status__)
25347 return margin_temp_info[0].marginTemperature
25350cpdef object device_get_clock_offsets(intptr_t device, nvmlClockType_t clock_type, nvmlPstates_t pstate):
25351 """Retrieve min, max and current clock offset of some clock domain for a given PState.
25353 Args:
25354 device (intptr_t): The identifier of the target device.
25356 Returns:
25357 nvmlClockOffset_v1_t: Structure specifying the clock type (input) and the pstate (input) retrieved clock offset value (output), min clock offset (output) and max clock offset (output).
25359 .. seealso:: `nvmlDeviceGetClockOffsets`
25360 """
25361 cdef ClockOffset_v1 info_py = ClockOffset_v1() 1b
25362 cdef nvmlClockOffset_v1_t *info = <nvmlClockOffset_v1_t *><intptr_t>(info_py._get_ptr()) 1b
25363 with nogil: 1b
25364 info.version = NVML_VERSION_STRUCT(sizeof(nvmlClockOffset_v1_t), 1) 1b
25365 info.type = clock_type 1b
25366 info.pstate = pstate 1b
25367 __status__ = nvmlDeviceGetClockOffsets(<Device>device, info) 1b
25368 check_status(__status__) 1b
25369 return info_py 1b
25372cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id, unsigned int mode):
25373 """Query the supported vGPU placement ID of the vGPU type.
25375 Args:
25376 device (intptr_t): Identifier of the target device.
25377 vgpu_type_id (unsigned int): Handle to vGPU type. The vGPU type ID.
25378 mode (unsigned int): The placement mode. 0: Heterogeneous, 1: Homogeneous.
25380 Returns:
25381 nvmlVgpuPlacementList_v2_t: Pointer to the vGPU placement structure ``nvmlVgpuPlacementList_t``.
25383 .. seealso:: `nvmlDeviceGetVgpuTypeSupportedPlacements`
25384 """
25385 cdef VgpuPlacementList_v2 p_placement_list_py = VgpuPlacementList_v2()
25386 cdef nvmlVgpuPlacementList_t *p_placement_list = <nvmlVgpuPlacementList_t *><intptr_t>(p_placement_list_py._get_ptr())
25387 with nogil:
25388 p_placement_list.count = 0
25389 p_placement_list.placementIds = NULL
25390 p_placement_list.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementList_v2_t), 2)
25391 __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(<Device>device, <nvmlVgpuTypeId_t>vgpu_type_id, p_placement_list)
25392 check_status_size(__status__)
25394 if p_placement_list.count == 0:
25395 return p_placement_list_py
25397 cdef view.array placement_ids = view.array(shape=(p_placement_list.count,), itemsize=sizeof(unsigned int), format="I", mode="c")
25398 p_placement_list_py.placement_ids = placement_ids
25400 with nogil:
25401 __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(<Device>device, <nvmlVgpuTypeId_t>vgpu_type_id, p_placement_list)
25402 check_status(__status__)
25404 return p_placement_list_py
25407cpdef unsigned int vgpu_instance_get_placement_id(unsigned int vgpu_instance):
25408 """Query the placement ID of active vGPU instance.
25410 Args:
25411 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
25413 Returns:
25414 unsigned int: The placement ID
25416 .. seealso:: `nvmlVgpuInstanceGetPlacementId`
25417 """
25418 cdef nvmlVgpuPlacementId_t[1] p_placement
25419 with nogil:
25420 p_placement[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementId_v1_t), 1)
25421 __status__ = nvmlVgpuInstanceGetPlacementId(<nvmlVgpuInstance_t>vgpu_instance, p_placement)
25422 check_status(__status__)
25423 return p_placement[0].placementId
25426cpdef object device_get_capabilities(intptr_t device):
25427 """Get device capabilities.
25429 Args:
25430 device (intptr_t): The identifier of the target device.
25432 Returns:
25433 nvmlDeviceCapabilities_v1_t: Returns GPU's capabilities.
25435 .. seealso:: `nvmlDeviceGetCapabilities`
25436 """
25437 cdef nvmlDeviceCapabilities_t[1] caps
25438 with nogil: 2Wb
25439 caps[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceCapabilities_v1_t), 1) 2Wb
25440 __status__ = nvmlDeviceGetCapabilities(<Device>device, caps) 2Wb
25441 check_status(__status__) 2Wb
25442 return caps[0].capMask 2Wb
25445cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device, char[32] nonce):
25446 """Get Conf Computing GPU attestation report.
25448 Args:
25449 device (intptr_t): The identifier of the target device.
25451 Returns:
25452 nvmlConfComputeGpuAttestationReport_t: Reference in which to return the gpu attestation report.
25454 .. seealso:: `nvmlDeviceGetConfComputeGpuAttestationReport`
25455 """
25456 cdef ConfComputeGpuAttestationReport gpu_atst_report_py = ConfComputeGpuAttestationReport() 1z
25457 cdef nvmlConfComputeGpuAttestationReport_t *gpu_atst_report = <nvmlConfComputeGpuAttestationReport_t *><intptr_t>(gpu_atst_report_py._get_ptr()) 1z
25458 with nogil: 1z
25459 memcpy(gpu_atst_report.nonce, nonce, 32) 1z
25460 __status__ = nvmlDeviceGetConfComputeGpuAttestationReport(<Device>device, gpu_atst_report) 1z
25461 check_status(__status__) 1z
25462 return gpu_atst_report_py
25465cpdef tuple device_get_dram_encryption_mode(intptr_t device):
25466 """Retrieves the current and pending DRAM Encryption modes for the device.
25468 Args:
25469 device (intptr_t): The identifier of the target device.
25471 Returns:
25472 A 2-tuple containing:
25474 - nvmlEnableState_t: Reference in which to return the current DRAM Encryption mode.
25475 - nvmlEnableState_t: Reference in which to return the pending DRAM Encryption mode.
25477 .. seealso:: `nvmlDeviceGetDramEncryptionMode`
25478 """
25479 cdef nvmlDramEncryptionInfo_t current
25480 cdef nvmlDramEncryptionInfo_t pending
25481 with nogil:
25482 current.version = pending.version = NVML_VERSION_STRUCT(sizeof(nvmlDramEncryptionInfo_t), 1)
25483 __status__ = nvmlDeviceGetDramEncryptionMode(<Device>device, ¤t, &pending)
25484 check_status(__status__)
25485 return (current.encryptionState, pending.encryptionState)
25488cpdef device_set_dram_encryption_mode(intptr_t device, int dram_encryption):
25489 """Set the DRAM Encryption mode for the device.
25491 Args:
25492 device (intptr_t): The identifier of the target device.
25493 dram_encryption (nvmlEnableState_t): The target DRAM Encryption mode.
25495 .. seealso:: `nvmlDeviceSetDramEncryptionMode`
25496 """
25497 cdef nvmlDramEncryptionInfo_t[1] encryption
25498 with nogil:
25499 encryption[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDramEncryptionInfo_t), 1)
25500 encryption[0].encryptionState = <nvmlEnableState_t>dram_encryption
25501 __status__ = nvmlDeviceSetDramEncryptionMode(<Device>device, encryption)
25502 check_status(__status__)
25505cpdef object device_get_gpu_instance_profile_info_by_id_v(intptr_t device, unsigned int profile_id):
25506 """GPU instance profile query function that accepts profile ID, instead of profile name. It accepts a versioned ``nvmlGpuInstanceProfileInfo_v3_t`` or later output structure.
25508 Args:
25509 device (intptr_t): The identifier of the target device.
25510 profile_id (unsigned int): One of the profile IDs.
25512 Returns:
25513 nvmlGpuInstanceProfileInfo_v3_t: Returns detailed profile information.
25515 .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoByIdV`
25516 """
25517 cdef GpuInstanceProfileInfo_v3 info_py = GpuInstanceProfileInfo_v3()
25518 cdef nvmlGpuInstanceProfileInfo_v3_t *info = <nvmlGpuInstanceProfileInfo_v3_t *><intptr_t>(info_py._get_ptr())
25519 with nogil:
25520 info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuInstanceProfileInfo_v3_t), 3)
25521 __status__ = nvmlDeviceGetGpuInstanceProfileInfoByIdV(<Device>device, profile_id, <nvmlGpuInstanceProfileInfo_v2_t *>info)
25522 check_status(__status__)
25523 return info_py
25526cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile):
25527 """Versioned wrapper around ``nvmlDeviceGetGpuInstanceProfileInfo`` that accepts a versioned ``nvmlGpuInstanceProfileInfo_v3_t`` or later output structure.
25529 Args:
25530 device (intptr_t): The identifier of the target device.
25531 profile (unsigned int): One of the NVML_GPU_INSTANCE_PROFILE_*.
25533 Returns:
25534 nvmlGpuInstanceProfileInfo_v3_t: Returns detailed profile information.
25536 .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoV`
25537 """
25538 cdef GpuInstanceProfileInfo_v3 info_py = GpuInstanceProfileInfo_v3()
25539 cdef nvmlGpuInstanceProfileInfo_v3_t *info = <nvmlGpuInstanceProfileInfo_v3_t *><intptr_t>(info_py._get_ptr())
25540 with nogil:
25541 info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuInstanceProfileInfo_v3_t), 3)
25542 __status__ = nvmlDeviceGetGpuInstanceProfileInfoV(<Device>device, profile, <nvmlGpuInstanceProfileInfo_v2_t *>info)
25543 check_status(__status__)
25544 return info_py
25547cpdef intptr_t device_get_handle_by_uuidv(int type, bytes uuid) except? 0:
25548 """Acquire the handle for a particular device, based on its globally unique immutable UUID (in either ASCII or binary format) associated with each device. See ``nvmlUUID_v1_t`` for more information on the UUID struct. The caller must set the appropriate version prior to calling this API.
25550 Args:
25551 type (UUIDType): The format of the UUID being provided (ASCII or binary).
25552 uuid (intptr_t): The UUID of the target GPU or MIG instance.
25554 Returns:
25555 intptr_t: Reference in which to return the device handle or MIG device handle.
25557 .. seealso:: `nvmlDeviceGetHandleByUUIDV`
25558 """
25559 cdef Device device
25560 cdef nvmlUUID_t[1] uuid_struct
25561 cdef int NVML_DEVICE_UUID_ASCII_LEN = 41 10
25562 cdef int NVML_DEVICE_UUID_BINARY_LEN = 16 10
25563 cdef char *uuid_ptr = cpython.PyBytes_AsString(uuid) 10
25565 if type == UUIDType.ASCII: 10
25566 if len(uuid) != NVML_DEVICE_UUID_ASCII_LEN - 1: 10
25567 raise ValueError(f"UUID ASCII string must be {NVML_DEVICE_UUID_ASCII_LEN - 1} bytes long")
25568 memcpy(<void *>(uuid_struct[0].value.str), <void *>uuid_ptr, NVML_DEVICE_UUID_ASCII_LEN) 10
25569 elif type == UUIDType.BINARY:
25570 if len(uuid) != NVML_DEVICE_UUID_BINARY_LEN - 1:
25571 raise ValueError(f"UUID binary string must be {NVML_DEVICE_UUID_BINARY_LEN - 1} bytes long")
25572 memcpy(<void *>(uuid_struct[0].value.bytes), <void *>uuid_ptr, NVML_DEVICE_UUID_BINARY_LEN)
25573 else:
25574 raise ValueError("Invalid UUID format specified")
25576 with nogil: 10
25577 uuid_struct[0].version = NVML_VERSION_STRUCT(sizeof(nvmlUUID_v1_t), 1) 10
25578 uuid_struct[0].type = type 10
25579 __status__ = nvmlDeviceGetHandleByUUIDV(uuid_struct, &device) 10
25580 check_status(__status__) 10
25581 return <intptr_t>device 10
25584cpdef unsigned long long device_get_pdi(intptr_t device):
25585 """Retrieves the Per Device Identifier (PDI) associated with this device.
25587 Args:
25588 device (intptr_t): The identifier of the target device.
25590 Returns:
25591 unsigned long long: The GPU PDI.
25593 .. seealso:: `nvmlDeviceGetPdi`
25594 """
25595 cdef nvmlPdi_v1_t[1] pdi
25596 with nogil: 2Xb
25597 pdi[0].version = NVML_VERSION_STRUCT(sizeof(nvmlPdi_v1_t), 1) 2Xb
25598 __status__ = nvmlDeviceGetPdi(<Device>device, pdi) 2Xb
25599 check_status(__status__) 2Xb
25600 return pdi[0].value 2Xb
25603cpdef str device_get_performance_modes(intptr_t device):
25604 """Retrieves a performance mode string with all the performance modes defined for this device along with their associated GPU Clock and Memory Clock values. Not all tokens will be reported on all GPUs, and additional tokens may be added in the future. For backwards compatibility we still provide nvclock and memclock; those are the same as nvclockmin and memclockmin.
25606 Args:
25607 device (intptr_t): The identifier of the target device.
25609 Returns:
25610 str: The performance level string.
25612 .. seealso:: `nvmlDeviceGetPerformanceModes`
25613 """
25614 cdef nvmlDevicePerfModes_t[1] perf_modes
25615 with nogil: 2ob
25616 perf_modes[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDevicePerfModes_v1_t), 1) 2ob
25617 __status__ = nvmlDeviceGetPerformanceModes(<Device>device, perf_modes) 2ob
25618 check_status(__status__) 2ob
25619 return cpython.PyUnicode_FromString(perf_modes[0].str) 2ob
25622cpdef unsigned int device_get_unrepairable_memory_flag_v1(intptr_t device):
25623 """Get the unrepairable memory flag for a given GPU.
25625 Args:
25626 device (intptr_t): The identifier of the target device.
25628 Returns:
25629 unsigned int: unrepairable memory status
25631 .. seealso:: `nvmlDeviceGetUnrepairableMemoryFlag_v1`
25632 """
25633 cdef nvmlUnrepairableMemoryStatus_v1_t[1] unrepairable_memory_status
25634 with nogil:
25635 __status__ = nvmlDeviceGetUnrepairableMemoryFlag_v1(<Device>device, unrepairable_memory_status)
25636 check_status(__status__)
25637 return unrepairable_memory_status.bUnrepairableMemory
25640cpdef unsigned int device_get_vgpu_heterogeneous_mode(intptr_t device):
25641 """Get the vGPU heterogeneous mode for the device.
25643 Args:
25644 device (intptr_t): The identifier of the target device.
25646 Returns:
25647 unsigned int: The mode
25649 .. seealso:: `nvmlDeviceGetVgpuHeterogeneousMode`
25650 """
25651 cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode
25652 with nogil: 1H
25653 heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) 1H
25654 __status__ = nvmlDeviceGetVgpuHeterogeneousMode(<Device>device, heterogeneous_mode) 1H
25655 check_status(__status__) 1H
25656 return heterogeneous_mode[0].mode
25659cpdef device_set_vgpu_heterogeneous_mode(intptr_t device, int mode):
25660 """Enable or disable vGPU heterogeneous mode for the device.
25662 Args:
25663 device (intptr_t): Identifier of the target device.
25664 heterogeneous_mode (unsigned int): mode
25666 .. seealso:: `nvmlDeviceSetVgpuHeterogeneousMode`
25667 """
25668 cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode
25669 with nogil:
25670 heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1)
25671 heterogeneous_mode[0].mode = mode
25672 __status__ = nvmlDeviceSetVgpuHeterogeneousMode(<Device>device, heterogeneous_mode)
25673 check_status(__status__)
25676cpdef object gpu_instance_get_vgpu_heterogeneous_mode(intptr_t gpu_instance):
25677 """Get the vGPU heterogeneous mode for the GPU instance.
25679 Args:
25680 gpu_instance (intptr_t): The GPU instance handle.
25682 Returns:
25683 unsigned int: the mode
25685 .. seealso:: `nvmlGpuInstanceGetVgpuHeterogeneousMode`
25686 """
25687 cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode
25688 with nogil:
25689 heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1)
25690 __status__ = nvmlGpuInstanceGetVgpuHeterogeneousMode(<GpuInstance>gpu_instance, heterogeneous_mode)
25691 check_status(__status__)
25692 return heterogeneous_mode[0].mode
25695cpdef gpu_instance_set_vgpu_heterogeneous_mode(intptr_t gpu_instance, unsigned int mode):
25696 """Enable or disable vGPU heterogeneous mode for the GPU instance.
25698 Args:
25699 gpu_instance (intptr_t): The GPU instance handle.
25700 mode (unsigned int): The mode
25702 .. seealso:: `nvmlGpuInstanceSetVgpuHeterogeneousMode`
25703 """
25704 cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode
25705 with nogil:
25706 heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1)
25707 heterogeneous_mode[0].mode = mode
25708 __status__ = nvmlGpuInstanceSetVgpuHeterogeneousMode(<GpuInstance>gpu_instance, heterogeneous_mode)
25709 check_status(__status__)
25712cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp):
25713 """Retrieves current utilization for vGPUs on a physical GPU (device).
25715 Args:
25716 device (intptr_t): The identifier for the target device.
25717 last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp.
25719 Returns:
25720 A 2-tuple containing:
25722 - samples: Returned sample values.
25723 - utilizationSamples: Utilization samples.
25725 .. seealso:: `nvmlDeviceGetVgpuUtilization`
25726 """
25727 cdef unsigned int vgpu_instance_samples_count
25728 with nogil:
25729 __status__ = nvmlDeviceGetVgpuUtilization(
25730 <Device>device,
25731 last_seen_time_stamp,
25732 NULL,
25733 &vgpu_instance_samples_count,
25734 NULL
25735 )
25736 check_status_size(__status__)
25738 if vgpu_instance_samples_count == 0:
25739 return (
25740 view.array(shape=(1,), itemsize=sizeof(int), format="I", mode="c")[:0],
25741 VgpuInstanceUtilizationSample(0)
25742 )
25744 cdef view.array arr = view.array(shape=(vgpu_instance_samples_count,), itemsize=sizeof(int), format="I", mode="c")
25745 cdef VgpuInstanceUtilizationSample utilization_samples_py = VgpuInstanceUtilizationSample(vgpu_instance_samples_count)
25746 cdef nvmlVgpuInstanceUtilizationSample_t *ptr = <nvmlVgpuInstanceUtilizationSample_t *>utilization_samples_py._get_ptr()
25748 with nogil:
25749 __status__ = nvmlDeviceGetVgpuUtilization(
25750 <Device>device,
25751 last_seen_time_stamp,
25752 <nvmlValueType_t *>arr.data,
25753 &vgpu_instance_samples_count,
25754 ptr
25755 )
25756 check_status(__status__)
25758 return (arr, utilization_samples_py)
25761cpdef object device_read_prm_counters_v1(intptr_t device, PRMCounter_v1 counters):
25762 """Read a list of GPU PRM Counters.
25764 Args:
25765 device (intptr_t): Identifer of target GPU device.
25766 counters (PRMCounter_v1): Array holding the input parameters as well as the retrieved counter values.
25768 .. seealso:: `nvmlDeviceReadPRMCounters_v1`
25769 """
25770 # Unlike in the raw C API, counter_list here is an PRMCounter_v1
25771 # AUTO_LOWPP_ARRAY, and we need to wrap it in a nvmlPRMCounterList_v1_t.
25773 cdef nvmlPRMCounterList_v1_t[1] counter_list
25774 counter_list[0].numCounters = len(counters)
25775 counter_list[0].counters = <nvmlPRMCounter_v1_t *>counters._get_ptr()
25777 with nogil:
25778 __status__ = nvmlDeviceReadPRMCounters_v1(<Device>device, <nvmlPRMCounterList_v1_t*>counter_list)
25779 check_status(__status__)
25781 return counters
25784ctypedef union __nvmlPRMTLV_v1_value_t:
25785 char[496] inData
25786 char[496] outData
25789ctypedef struct __nvmlPRMTLV_v1_t:
25790 unsigned dataSize
25791 unsigned status
25792 __nvmlPRMTLV_v1_value_t value
25795cpdef tuple device_read_write_prm_v1(intptr_t device, bytes in_data):
25796 """Read or write a GPU PRM register. The input is assumed to be in TLV format in network byte order.
25798 Args:
25799 device (intptr_t): Identifer of target GPU device.
25800 in_data (bytes): The input data for the PRM register.
25802 Returns:
25803 A 2-tuple containing:
25805 - unsigned int: Status of the PRM operation.
25806 - bytes: Output data in TLV format.
25808 .. seealso:: `nvmlDeviceReadWritePRM_v1`
25809 """
25810 cdef int NVML_PRM_DATA_MAX_SIZE = 496 1J
25811 cdef __nvmlPRMTLV_v1_t buffer
25812 cdef int in_data_size = len(in_data) 1J
25814 if in_data_size > NVML_PRM_DATA_MAX_SIZE - 1: 1J
25815 raise ValueError(f"Input data size exceeds maximum allowed size of {NVML_PRM_DATA_MAX_SIZE - 1} bytes")
25817 cdef char *in_data_ptr = cpython.PyBytes_AsString(in_data) 1J
25819 with nogil: 1J
25820 memcpy(<void *>(buffer.value.inData), <void *>in_data_ptr, in_data_size) 1J
25821 buffer.dataSize = in_data_size 1J
25822 __status__ = nvmlDeviceReadWritePRM_v1(<Device>device, <nvmlPRMTLV_v1_t *>&buffer) 1J
25823 check_status(__status__) 1J
25825 cdef bytes out_data = cpython.PyBytes_FromStringAndSize(buffer.value.outData, buffer.dataSize)
25826 cdef unsigned int status = buffer.status
25828 return (status, out_data)
25831cpdef device_set_nvlink_device_low_power_threshold(intptr_t device, unsigned int threshold):
25832 """Set NvLink Low Power Threshold for device.
25834 Args:
25835 device (intptr_t): The identifier of the target device.
25836 threshold (unsigned int):
25838 .. seealso:: `nvmlDeviceSetNvLinkDeviceLowPowerThreshold`
25839 """
25840 cdef nvmlNvLinkPowerThres_t[1] info
25842 with nogil: 1I
25843 info[0].lowPwrThreshold 1I
25844 __status__ = nvmlDeviceSetNvLinkDeviceLowPowerThreshold(<Device>device, <nvmlNvLinkPowerThres_t*>info) 1I
25845 check_status(__status__) 1I
25848cpdef device_set_power_management_limit_v2(intptr_t device, int power_scope, unsigned int power_value_mw):
25849 """Set new power limit of this device.
25851 Args:
25852 device (intptr_t): The identifier of the target device.
25853 power_scope (PowerScope): Device type
25854 power_value_mw (unsigned int): Power value to retrieve or set in milliwatts
25856 .. seealso:: `nvmlDeviceSetPowerManagementLimit_v2`
25857 """
25858 cdef nvmlPowerValue_v2_t[1] power_value
25860 with nogil: 1V
25861 power_value[0].version = NVML_VERSION_STRUCT(sizeof(nvmlPowerValue_v2_t), 2) 1V
25862 power_value[0].powerScope = <nvmlPowerScopeType_t>power_scope 1V
25863 power_value[0].powerValueMw = power_value_mw 1V
25864 __status__ = nvmlDeviceSetPowerManagementLimit_v2(<Device>device, power_value) 1V
25865 check_status(__status__) 1V
25868cpdef device_set_rusd_settings_v1(intptr_t device, unsigned long long poll_mask):
25869 """Set Read-only user shared data (RUSD) settings for GPU. Requires root/admin permissions.
25871 Args:
25872 device (intptr_t): The identifier of the target device.
25873 poll_mask (unsigned long long): Bitmask of polling data. 0 value means the GPU's RUSD polling mask is cleared
25875 .. seealso:: `nvmlDeviceSetRusdSettings_v1`
25876 """
25877 cdef nvmlRusdSettings_v1_t[1] settings
25878 with nogil:
25879 settings[0].version = NVML_VERSION_STRUCT(sizeof(nvmlRusdSettings_v1_t), 1)
25880 settings[0].pollMask = poll_mask
25881 __status__ = nvmlDeviceSetRusdSettings_v1(<Device>device, settings)
25882 check_status(__status__)
25885cpdef device_set_temperature_threshold(intptr_t device, int threshold_type, int temp):
25886 """Sets the temperature threshold for the GPU with the specified threshold type in degrees C.
25888 Args:
25889 device (intptr_t): The identifier of the target device.
25890 threshold_type (TemperatureThresholds): The type of threshold value to be set.
25891 temp (int): The value to be set.
25893 .. seealso:: `nvmlDeviceSetTemperatureThreshold`
25894 """
25895 with nogil:
25896 __status__ = nvmlDeviceSetTemperatureThreshold(<Device>device, <_TemperatureThresholds>threshold_type, &temp)
25897 check_status(__status__)
25900cpdef unsigned long long system_get_conf_compute_key_rotation_threshold_info():
25901 """Get Conf Computing key rotation threshold detail.
25903 Returns:
25904 unsigned long long: The key rotation threshold data.
25906 .. seealso:: `nvmlSystemGetConfComputeKeyRotationThresholdInfo`
25907 """
25908 cdef nvmlConfComputeGetKeyRotationThresholdInfo_t[1] key_rotation_thr_info
25909 with nogil:
25910 key_rotation_thr_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t), 1)
25911 __status__ = nvmlSystemGetConfComputeKeyRotationThresholdInfo(key_rotation_thr_info)
25912 check_status(__status__)
25913 return key_rotation_thr_info[0].attackerAdvantage
25916cpdef system_set_conf_compute_key_rotation_threshold_info(unsigned long long max_attacker_advantage):
25917 """Set Conf Computing key rotation threshold.
25919 Args:
25920 max_attacker_advantage (unsigned long long): The key rotation threshold data.
25922 .. seealso:: `nvmlSystemSetConfComputeKeyRotationThresholdInfo`
25923 """
25924 cdef nvmlConfComputeSetKeyRotationThresholdInfo_t[1] key_rotation_thr_info
25925 with nogil:
25926 key_rotation_thr_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlConfComputeSetKeyRotationThresholdInfo_v1_t), 1)
25927 key_rotation_thr_info[0].maxAttackerAdvantage = max_attacker_advantage
25928 __status__ = nvmlSystemSetConfComputeKeyRotationThresholdInfo(key_rotation_thr_info)
25929 check_status(__status__)
25932cpdef unsigned long long vgpu_instance_get_runtime_state_size(unsigned int vgpu_instance):
25933 """Retrieve the currently used runtime state size of the vGPU instance.
25935 Args:
25936 vgpu_instance (unsigned int): Identifier of the target vGPU instance.
25938 Returns:
25939 unsigned long long: Runtime state size of the vGPU instance.
25941 .. seealso:: `nvmlVgpuInstanceGetRuntimeStateSize`
25942 """
25943 cdef nvmlVgpuRuntimeState_t[1] p_state
25944 with nogil:
25945 p_state[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuRuntimeState_v1_t), 1)
25946 __status__ = nvmlVgpuInstanceGetRuntimeStateSize(<nvmlVgpuInstance_t>vgpu_instance, p_state)
25947 check_status(__status__)
25948 return p_state[0].size
25951cpdef unsigned int vgpu_type_get_max_instances_per_gpu_instance(unsigned int vgpu_type_id):
25952 """Retrieve the maximum number of vGPU instances per GPU instance for given vGPU type.
25954 Args:
25955 vgpu_type_id (VgpuTypeId): Handle to vGPU type.
25957 Returns:
25958 unsigned int: Maximum number of vGPU instances per GPU instance
25960 .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerGpuInstance`
25961 """
25962 cdef nvmlVgpuTypeMaxInstance_t[1] max_instance
25963 with nogil:
25964 max_instance[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeMaxInstance_v1_t), 1)
25965 max_instance[0].vgpuTypeId = <nvmlVgpuTypeId_t>vgpu_type_id
25966 __status__ = nvmlVgpuTypeGetMaxInstancesPerGpuInstance(max_instance)
25967 check_status(__status__)
25968 return max_instance[0].maxInstancePerGI
25971cpdef str device_get_current_clock_freqs(intptr_t device):
25972 """Retrieves a string with the associated current GPU Clock and Memory Clock values.
25974 Args:
25975 device (intptr_t): The identifier of the target device.
25977 Returns:
25978 str: The current clock frequency string.
25980 .. seealso:: `nvmlDeviceGetCurrentClockFreqs`
25981 """
25982 cdef nvmlDeviceCurrentClockFreqs_t[1] current_clock_freqs
25983 with nogil: 2nb
25984 current_clock_freqs[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceCurrentClockFreqs_v1_t), 1) 2nb
25985 __status__ = nvmlDeviceGetCurrentClockFreqs(<Device>device, current_clock_freqs) 2nb
25986 check_status(__status__) 2nb
25987 return cpython.PyUnicode_FromString(current_clock_freqs[0].str) 2nb